@SuppressWarnings("rawtypes") public Object convert(final Class type, final Object value) { if (value instanceof String) { return Enum.valueOf(Case.class, ((String) value).toUpperCase()); } throw new ConversionException("Could not convert value: [" + value + "] to Case type."); } }
public void setValue(final FacesContext context, final String expression, final Object value) throws ELException { ValueBinding valueBinding = context.getApplication().createValueBinding(expression); Class<?> type = valueBinding.getType(context); Converter converter = ConvertUtils.lookup(type); if (converter == null) { throw new UnsupportedOperationException("Cant deal with " + type); } valueBinding.setValue(context, converter.convert(type, value)); }
public void parse(final PrettyConfigBuilder builder, final InputStream resource) throws IOException, SAXException { if (builder == null) { throw new IllegalArgumentException("Builder must not be null."); } if (resource == null) { throw new IllegalArgumentException("Input stream must not be null."); } final Digester digester = configureDigester(new Digester()); ConvertUtils.register(caseConverter, Case.class); ConvertUtils.register(trailingSlashConverter, TrailingSlash.class); ConvertUtils.register(phaseIdConverter, PhaseId.class); ConvertUtils.register(redirectConverter, Redirect.class); digester.push(builder); digester.parse(resource); }
@SuppressWarnings("rawtypes") public Object convert(final Class type, final Object value) { if (value instanceof String) { return Enum.valueOf(TrailingSlash.class, ((String) value).toUpperCase()); } throw new ConversionException("Could not convert value: [" + value + "] to TrailingSlash type."); } }
public void parse(final PrettyConfigBuilder builder, final InputStream resource) throws IOException, SAXException { if (builder == null) { throw new IllegalArgumentException("Builder must not be null."); } if (resource == null) { throw new IllegalArgumentException("Input stream must not be null."); } final Digester digester = configureDigester(new Digester()); ConvertUtils.register(caseConverter, Case.class); ConvertUtils.register(trailingSlashConverter, TrailingSlash.class); ConvertUtils.register(phaseIdConverter, PhaseId.class); ConvertUtils.register(redirectConverter, Redirect.class); digester.push(builder); digester.parse(resource); }
@SuppressWarnings("rawtypes") public Object convert(final Class type, final Object value) { if (value instanceof String) { return Enum.valueOf(Case.class, ((String) value).toUpperCase()); } throw new ConversionException("Could not convert value: [" + value + "] to Case type."); } }
@SuppressWarnings("rawtypes") public Object convert(final Class type, final Object value) { if (value instanceof String) { return Enum.valueOf(TrailingSlash.class, ((String) value).toUpperCase()); } throw new ConversionException("Could not convert value: [" + value + "] to TrailingSlash type."); } }
@SuppressWarnings("rawtypes") public Object convert(final Class type, final Object value) { if (value instanceof String) { String item = (String) value; if ("301".equals(item)) { item = "PERMANENT"; } else if ("302".equals(item)) { item = "TEMPORARY"; } return Enum.valueOf(Redirect.class, item.toUpperCase()); } throw new ConversionException("Could not convert value: [" + value + "] to Redirect type."); } }
@SuppressWarnings("rawtypes") public Object convert(final Class type, final Object value) { if (value instanceof String) { String item = (String) value; if ("301".equals(item)) { item = "PERMANENT"; } else if ("302".equals(item)) { item = "TEMPORARY"; } return Enum.valueOf(Redirect.class, item.toUpperCase()); } throw new ConversionException("Could not convert value: [" + value + "] to Redirect type."); } }
throw new ConversionException("Could not convert value: [" + value + "] to FacesPhaseId type.");
throw new ConversionException("Could not convert value: [" + value + "] to FacesPhaseId type.");