/** * @see com.sun.faces.application.annotation.ConfigAnnotationHandler#collect(Class, java.lang.annotation.Annotation) */ @Override public void collect(Class<?> target, Annotation annotation) { if (converters == null) { converters = new HashMap<Object,String>(); } Object key; FacesConverter converterAnnotation = (FacesConverter) annotation; if (converterAnnotation.value().length() > 0 && converterAnnotation.forClass() != null && converterAnnotation.forClass() != Object.class) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "@FacesConverter is using both value and forClass, only value will be applied."); } } if (0 == converterAnnotation.value().length()) { key = converterAnnotation.forClass(); } else { key = converterAnnotation.value(); } converters.put(key, target.getName()); }
/** * @see com.sun.faces.application.annotation.ConfigAnnotationHandler#collect(Class, java.lang.annotation.Annotation) */ @Override public void collect(Class<?> target, Annotation annotation) { if (converters == null) { converters = new HashMap<>(); } Object key; FacesConverter converterAnnotation = (FacesConverter) annotation; if (converterAnnotation.value().length() > 0 && converterAnnotation.forClass() != null && converterAnnotation.forClass() != Object.class) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "@FacesConverter is using both value and forClass, only value will be applied."); } } if (0 == converterAnnotation.value().length()) { key = converterAnnotation.forClass(); } else { key = converterAnnotation.value(); } converters.put(key, target.getName()); }
/** * @see com.sun.faces.application.annotation.ConfigAnnotationHandler#collect(Class, java.lang.annotation.Annotation) */ @Override public void collect(Class<?> target, Annotation annotation) { if (converters == null) { converters = new HashMap<>(); } Object key; FacesConverter converterAnnotation = (FacesConverter) annotation; if (converterAnnotation.value().length() > 0 && converterAnnotation.forClass() != null && converterAnnotation.forClass() != Object.class) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "@FacesConverter is using both value and forClass, only value will be applied."); } } if (0 == converterAnnotation.value().length()) { key = converterAnnotation.forClass(); } else { key = converterAnnotation.value(); } converters.put(key, target.getName()); }
/** * @see com.sun.faces.application.annotation.ConfigAnnotationHandler#collect(Class, java.lang.annotation.Annotation) */ @Override public void collect(Class<?> target, Annotation annotation) { if (converters == null) { converters = new HashMap<>(); } Object key; FacesConverter converterAnnotation = (FacesConverter) annotation; if (converterAnnotation.value().length() > 0 && converterAnnotation.forClass() != null && converterAnnotation.forClass() != Object.class) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "@FacesConverter is using both value and forClass, only value will be applied."); } } if (0 == converterAnnotation.value().length()) { key = converterAnnotation.forClass(); } else { key = converterAnnotation.value(); } converters.put(key, target.getName()); }
@Override protected Converter resolveInstanceForClass(FacesContext facesContext, Class<?> wrappedClass) { FacesConverter facesConverter = wrappedClass.getAnnotation(FacesConverter.class); if (facesConverter == null) { return null; } if (!"".equals(facesConverter.value())) { return facesContext.getApplication().createConverter(facesConverter.value()); } return facesContext.getApplication().createConverter(facesConverter.forClass()); } }
@Override protected Converter resolveInstanceForClass(FacesContext facesContext, Class<?> wrappedClass) { FacesConverter facesConverter = wrappedClass.getAnnotation(FacesConverter.class); if (facesConverter == null) { return null; } if (!"".equals(facesConverter.value())) { return facesContext.getApplication().createConverter(facesConverter.value()); } return facesContext.getApplication().createConverter(facesConverter.forClass()); } }
public <T> void collect(@Observes ProcessManagedBean<T> event) { if (event.getAnnotatedBeanClass().isAnnotationPresent(FacesConverter.class)) { Annotated annotated = event.getAnnotatedBeanClass(); Type type = annotated.getBaseType(); FacesConverter conv = (FacesConverter) annotated.getAnnotation(FacesConverter.class); if (conv.managed()) { boolean hasForClass = !Object.class.equals(conv.forClass()); boolean hasValue = conv.value().length() > 0; if (hasForClass || hasValue) { if (hasForClass) { types.add(new FacesConverterInfo(type, conv.forClass(), "")); } if (hasValue) { types.add(new FacesConverterInfo(type, Object.class, conv.value())); } } } } }