Refine search
/** * * @author madunlap * To sort our entity objects in the provenance bundle dropdown */ @FacesConverter("provEntityFileDataConverter") public class ProvEntityFileDataConverter implements Converter{ @Inject ProvPopupFragmentBean provBean; @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { return provBean.getEntityByEntityName(value); } @Override public String getAsString(FacesContext context, UIComponent component, Object value) { if (value == null || value.equals("")) { return ""; } else { return ((ProvEntityFileData) value).getEntityName(); } } }
@FacesConverter(value = "humanize.NanoTime") public class NanoTimeConverter extends NumberConverter { private static final long serialVersionUID = 5010346061889560233L; @Override public String getAsString(FacesContext context, UIComponent component, Object value) { return Humanize.nanoTime(asNumber(value), getLocale(context)); } }
/** * @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()); }
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())); } } } } }
if (annotation != null && annotation.managed())
@FacesConverter(value = "humanize.MetricPrefix") public class MetricPrefixConverter extends NumberConverter { private static final long serialVersionUID = 789707697926582865L; @Override public String getAsString(FacesContext context, UIComponent component, Object value) { return Humanize.metricPrefix(asNumber(value), getLocale(context)); } }
/** * @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()); }
if (annotation != null && annotation.managed())
@FacesConverter(value = "humanize.Slugify") public class SlugifyConverter extends BaseConverter { private static final long serialVersionUID = -446143597515448224L; @Override public String getAsString(FacesContext context, UIComponent component, Object value) { return Humanize.slugify(value.toString()); } }
/** * @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()); }
@FacesConverter(value = "humanize.BinaryPrefix") public class BinaryPrefixConverter extends NumberConverter { private static final long serialVersionUID = 1942567170903039630L; @Override public String getAsString(FacesContext context, UIComponent component, Object value) { return Humanize.binaryPrefix(asNumber(value), getLocale(context)); } }
/** * @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()); }
@FacesConverter(value = "projectServiceConverter") public class ProjectServicesConverter extends EnumConverter { public ProjectServicesConverter() { super(ProjectServiceEnum.class); } }
@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()); } }
@FacesConverter(value = "humanize.Ordinal") public class OrdinalConverter extends NumberConverter { private static final long serialVersionUID = -5459230181583940999L; @Override public String getAsString(FacesContext context, UIComponent component, Object value) { return Humanize.ordinal(asNumber(value), getLocale(context)); } }
@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()); } }
@FacesConverter(value = "humanize.NaturalDay") public class NaturalDayConverter extends BaseConverter { private static final long serialVersionUID = -6615733185378981191L; @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { return asDate(value); } @Override public String getAsString(FacesContext context, UIComponent component, Object value) { return Humanize.naturalDay(asDate(value), getLocale(context)); } }
log.finest("addConverter(" + conv.value() + "," + clazz.getName() + ")"); boolean hasForClass = !Object.class.equals(conv.forClass()); boolean hasValue = conv.value().length() > 0; if (hasForClass || hasValue) if (hasForClass) converter.setForClass(conv.forClass().getName()); converter.setConverterId(conv.value());
@FacesConverter(forClass = IBaseEntity.class) public class BaseEntityJsfForClassConverter extends BaseEntityJsfConverter { }
log.finest("addConverter(" + conv.value() + "," + clazz.getName() + ")"); boolean hasForClass = !Object.class.equals(conv.forClass()); boolean hasValue = conv.value().length() > 0; if (hasForClass || hasValue) if (hasForClass) converter.setForClass(conv.forClass().getName()); converter.setConverterId(conv.value());