static Class getValueType(final FacesContext context, final UIOutput component) { final ValueBinding vb = component.getValueBinding("value"); if (vb == null) { return null; } final Class valueType = vb.getType(context); if (valueType == null) { return null; } if (valueType.isArray()) { return valueType.getComponentType(); } else { return valueType; } }
static Converter findUIOutputConverter(FacesContext facesContext, UIOutput component) { // Attention! // This code is duplicated in jsfapi component package. // If you change something here please do the same in the other class! Converter converter = component.getConverter(); if (converter != null) return converter; //Try to find out by value binding ValueBinding vb = component.getValueBinding("value"); if (vb == null) return null; Class valueType = vb.getType(facesContext); if (valueType == null) return null; if (String.class.equals(valueType)) return null; //No converter needed for String type if (Object.class.equals(valueType)) return null; //There is no converter for Object class try { return facesContext.getApplication().createConverter(valueType); } catch (FacesException e) { log(facesContext, "No Converter for type " + valueType.getName() + " found", e); return null; } }
static Converter findUIOutputConverter(FacesContext facesContext, UIOutput component) { // Attention! // This code is duplicated in jsfapi component package. // If you change something here please do the same in the other class! Converter converter = component.getConverter(); if (converter != null) return converter; //Try to find out by value binding ValueBinding vb = component.getValueBinding("value"); if (vb == null) return null; Class valueType = vb.getType(facesContext); if (valueType == null) return null; if (String.class.equals(valueType)) return null; //No converter needed for String type if (Object.class.equals(valueType)) return null; //There is no converter for Object class try { return facesContext.getApplication().createConverter(valueType); } catch (FacesException e) { log(facesContext, "No Converter for type " + valueType.getName() + " found", e); return null; } }
public static Converter findConverter(final FacesContext context, final UIOutput component) { Converter converter = component.getConverter(); if (converter != null) { return converter; } ValueBinding vb = component.getValueBinding("value"); if (vb != null) { String expression = vb.getExpressionString(); converter = ConverterResource.getConverter(expression); if (converter != null) { return converter; } } final Class valueType = getValueType(context, component); if (ComponentUtil_.isPerformNoConversion(valueType)) { return null; } try { return context.getApplication().createConverter(valueType); } catch (final FacesException ex) { logger.log(ex); return null; } }