Refine search
protected Class getValueType(FacesContext context, UIInput input) { ValueExpression ve = input.getValueExpression("value"); Class type = ve == null ? String.class : ve.getType(context.getELContext()); return type == null ? String.class : type; }
protected Converter findImplicitConverter(FacesContext context, UIComponent component) { ValueExpression ve = component.getValueExpression("value"); if (ve != null) { Class<?> valueType = ve.getType(context.getELContext()); if (valueType != null) { if (valueType.isArray()) { valueType = valueType.getComponentType(); } return context.getApplication().createConverter(valueType); } } return null; }
void decodeMultipleSelection(FacesContext context, DataTable table, String selection) { ValueExpression selectionByVE = table.getValueExpression(DataTable.PropertyKeys.selection.toString()); Class<?> clazz = selectionByVE == null ? null : selectionByVE.getType(context.getELContext()); boolean isArray = clazz == null ? false : clazz.isArray();
ValueExpression valueExpression = inputNumber.getValueExpression("value"); if (valueExpression != null) { Class<?> type = valueExpression.getType(context.getELContext()); if (type != null && type.isPrimitive() && !LangUtils.isValueBlank(inputNumber.getMinValue())) {
public static final String getValue(FacesContext context, UICalendar calendar, Object value, String pattern) { //first ask the converter if (calendar.getConverter() != null) { return calendar.getConverter().getAsString(context, calendar, value); } else if (value instanceof String) { return (String) value; } //Use built-in converter else if (value instanceof Date) { SimpleDateFormat format = new SimpleDateFormat(pattern, calendar.calculateLocale(context)); format.setTimeZone(calculateTimeZone(calendar.getTimeZone())); return format.format((Date) value); } else { //Delegate to global defined converter (e.g. joda or java8) ValueExpression ve = calendar.getValueExpression("value"); if (ve != null) { Class type = ve.getType(context.getELContext()); if (type != null && type != Object.class && type != Date.class) { Converter converter = context.getApplication().createConverter(type); if (converter != null) { return converter.getAsString(context, calendar, value); } } } throw new FacesException("Value could be either String or java.util.Date"); } }
/** * Finds appropriate converter for a given value holder * * @param context FacesContext instance * @param component ValueHolder instance to look converter for * @return Converter */ public static Converter getConverter(FacesContext context, UIComponent component) { if (!(component instanceof ValueHolder)) { return null; } Converter converter = ((ValueHolder) component).getConverter(); if (converter != null) { return converter; } ValueExpression valueExpression = component.getValueExpression("value"); if (valueExpression == null) { return null; } Class<?> converterType = valueExpression.getType(context.getELContext()); if (converterType == null || converterType == Object.class) { // no conversion is needed return null; } if (converterType == String.class && !PrimeApplicationContext.getCurrentInstance(context).getConfig().isStringConverterAvailable()) { return null; } return context.getApplication().createConverter(converterType); }
String var = menu.getVar(); ValueExpression value = menu.getValueExpression("value"); Class<?> valueType = value == null ? null : value.getType(context.getELContext());
ValueExpression ve = uicalendar.getValueExpression("value"); if (ve != null) { Class type = ve.getType(context.getELContext()); if (type != null && type != Object.class && type != Date.class) { Converter converter = context.getApplication().createConverter(type);
public Class<?> getExpectedType(final FacesContext context, final String expression) throws ELException { ExpressionFactory ef = context.getApplication().getExpressionFactory(); ValueExpression ve = ef.createValueExpression(context.getELContext(), expression, Object.class); return ve.getType(context.getELContext()); }
protected Class getValueType(FacesContext context, UIInput input) { ValueExpression ve = input.getValueExpression("value"); Class type = ve == null ? String.class : ve.getType(context.getELContext()); return type == null ? String.class : type; }
public Class<?> getExpectedType(final FacesContext context, final String expression) throws ELException { ExpressionFactory ef = context.getApplication().getExpressionFactory(); ValueExpression ve = ef.createValueExpression(context.getELContext(), expression, Object.class); return ve.getType(context.getELContext()); }
public Class<?> getExpectedType(final FacesContext context, final String expression) throws ELException { ExpressionFactory ef = context.getApplication().getExpressionFactory(); ValueExpression ve = ef.createValueExpression(context.getELContext(), expression, Object.class); return ve.getType(context.getELContext()); }
@Override public Class getType(FacesContext ctx) throws EvaluationException, PropertyNotFoundException { return getValueExpression(ctx).getType( ctx.getELContext() ); }
public Class<?> getExpectedType(final FacesContext context, final String expression) throws ELException { ExpressionFactory ef = context.getApplication().getExpressionFactory(); ValueExpression ve = ef.createValueExpression(context.getELContext(), expression, Object.class); return ve.getType(context.getELContext()); }
public Object coerceToType(final FacesContext context, final String expression, final Object value) throws ELException { ExpressionFactory ef = context.getApplication().getExpressionFactory(); ValueExpression ve = ef.createValueExpression(context.getELContext(), expression, Object.class); return ef.coerceToType(value, ve.getType(context.getELContext())); }
public Object coerceToType(final FacesContext context, final String expression, final Object value) throws ELException { ExpressionFactory ef = context.getApplication().getExpressionFactory(); ValueExpression ve = ef.createValueExpression(context.getELContext(), expression, Object.class); return ef.coerceToType(value, ve.getType(context.getELContext())); }
public Object coerceToType(final FacesContext context, final String expression, final Object value) throws ELException { ExpressionFactory ef = context.getApplication().getExpressionFactory(); ValueExpression ve = ef.createValueExpression(context.getELContext(), expression, Object.class); return ef.coerceToType(value, ve.getType(context.getELContext())); }
public Object coerceToType(final FacesContext context, final String expression, final Object value) throws ELException { ExpressionFactory ef = context.getApplication().getExpressionFactory(); ValueExpression ve = ef.createValueExpression(context.getELContext(), expression, Object.class); return ef.coerceToType(value, ve.getType(context.getELContext())); }
protected Converter findImplicitConverter(FacesContext context, UIComponent component) { ValueExpression ve = component.getValueExpression("value"); if (ve != null) { Class<?> valueType = ve.getType(context.getELContext()); if (valueType != null) { if (valueType.isArray()) { valueType = valueType.getComponentType(); } return context.getApplication().createConverter(valueType); } } return null; }
private Converter findImplicitConverter(FacesContext context, UIComponent component) { ValueExpression ve = component.getValueExpression("value"); if (ve != null) { Class<?> valueType = ve.getType(context.getELContext()); if (valueType != null) return context.getApplication().createConverter(valueType); } return null; }