protected Object coerceToModelType(FacesContext ctx, Object value, Class itemValueType) { Object newValue; try { ExpressionFactory ef = ctx.getApplication().getExpressionFactory(); newValue = ef.coerceToType(value, itemValueType); } catch (ELException | IllegalArgumentException ele) { newValue = value; } return newValue; }
public boolean isRTL() { if (rtl == null) { String param = context.getExternalContext().getInitParameter(Constants.ContextParams.DIRECTION); if (param == null) { rtl = false; } else { ELContext elContext = context.getELContext(); ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ValueExpression expression = expressionFactory.createValueExpression(elContext, param, String.class); String expressionValue = (String) expression.getValue(elContext); rtl = (expressionValue == null) ? false : expressionValue.equalsIgnoreCase("rtl"); } } return rtl; } }
private void processCustomArgListener(FacesContext context, ELContext elContext, AjaxBehaviorEvent event) throws AbortProcessingException { if (listenerWithCustomArg == null) { MethodExpression argListener = context.getApplication().getExpressionFactory(). createMethodExpression(elContext, listener.getExpressionString(), Void.class, new Class[]{event.getClass()}); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Try to invoke customListener: " + argListener.getExpressionString()); } argListener.invoke(elContext, new Object[]{event}); } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Try to invoke customListener: " + listenerWithCustomArg.getExpressionString()); } listenerWithCustomArg.invoke(elContext, new Object[]{event}); } } }
public static Object coerce(Object value, Class<?> toType) { FacesContext context = FacesContext.getCurrentInstance(); return context.getApplication().getExpressionFactory().coerceToType(value, toType); }
if (event instanceof MenuActionEvent) { FacesContext facesContext = getFacesContext(); ELContext eLContext = facesContext.getELContext(); MenuActionEvent menuActionEvent = (MenuActionEvent) event; MenuItem menuItem = menuActionEvent.getMenuItem(); MethodExpression noArgExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[0]); MethodExpression argExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[]{ActionEvent.class}); MethodExpression argExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[]{MenuActionEvent.class});
public String resolveDynamicField(ValueExpression expression) { if (expression == null) { return null; } FacesContext context = getFacesContext(); ELContext elContext = context.getELContext(); String expressionString = expression.getExpressionString(); // old syntax compatibility // #{car[column.property]} // new syntax is: // #{column.property} or even a method call if (expressionString.startsWith("#{" + getVar() + "[")) { expressionString = expressionString.substring(expressionString.indexOf("[") + 1, expressionString.indexOf("]")); expressionString = "#{" + expressionString + "}"; ValueExpression dynaVE = context.getApplication() .getExpressionFactory().createValueExpression(elContext, expressionString, String.class); return (String) dynaVE.getValue(elContext); } return (String) expression.getValue(elContext); }
public static Object coerce(Object value, Class<?> toType) { FacesContext context = FacesContext.getCurrentInstance(); return context.getApplication().getExpressionFactory().coerceToType(value, toType); }
public static Object convertToTypeNoLogging(FacesContext facesContext, Object value, Class<?> desiredClass) throws Exception { if (value == null) { return null; } ExpressionFactory expFactory = facesContext.getApplication().getExpressionFactory(); return expFactory.coerceToType(value, desiredClass); }
if (event instanceof MenuActionEvent) { FacesContext facesContext = getFacesContext(); ELContext eLContext = facesContext.getELContext(); MenuActionEvent menuActionEvent = (MenuActionEvent) event; MenuItem menuItem = menuActionEvent.getMenuItem(); MethodExpression noArgExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[0]); MethodExpression argExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[]{ActionEvent.class}); MethodExpression argExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[]{MenuActionEvent.class});
ELContext eLContext = context.getELContext(); ValueExpression ve = context.getApplication().getExpressionFactory().createValueExpression( context.getELContext(), dynamicContentEL, StreamedContent.class); streamedContent = (StreamedContent) ve.getValue(eLContext);
public static Object coerce(Object value, Class<?> toType) { FacesContext context = FacesContext.getCurrentInstance(); return context.getApplication().getExpressionFactory().coerceToType(value, toType); }
public static Object convertToTypeNoLogging(FacesContext facesContext, Object value, Class<?> desiredClass) throws Exception { if (value == null) { return null; } ExpressionFactory expFactory = facesContext.getApplication().getExpressionFactory(); return expFactory.coerceToType(value, desiredClass); }
SummaryRow summaryRow = table.getSummaryRow(); HeaderRow headerRow = table.getHeaderRow(); ELContext eLContext = context.getELContext(); ValueExpression groupByVE = null; ValueExpression tableSortByVE = table.getValueExpression(DataTable.PropertyKeys.sortBy.toString()); groupByVE = (table.getSortBy() == null || table.isMultiSort()) ? null : context.getApplication().getExpressionFactory().createValueExpression( eLContext, "#{" + table.getVar() + "." + table.getSortBy() + "}", Object.class);
public static Object coerce(Object value, Class<?> toType) { FacesContext context = FacesContext.getCurrentInstance(); return context.getApplication().getExpressionFactory().coerceToType(value, toType); }
private Object coerceToModelType(FacesContext ctx, Object value, Class<? extends Object> itemValueType) { Object newValue; try { ExpressionFactory ef = ctx.getApplication().getExpressionFactory(); newValue = ef.coerceToType(value, itemValueType); } catch (ELException ele) { newValue = value; } catch (IllegalArgumentException iae) { newValue = value; } return newValue; }
ResponseWriter writer = context.getResponseWriter(); PrimeApplicationContext applicationContext = PrimeApplicationContext.getCurrentInstance(context); ProjectStage projectStage = context.getApplication().getProjectStage(); boolean csvEnabled = applicationContext.getConfig().isClientSideValidationEnabled(); ELContext elContext = context.getELContext(); ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ValueExpression ve = expressionFactory.createValueExpression(elContext, themeParamValue, String.class);
public void processAction(ActionEvent evt) throws AbortProcessingException { FacesContext faces = FacesContext.getCurrentInstance(); ELContext el = faces.getELContext(); Object valueObj = this.value.getValue(el); if (valueObj != null) { ExpressionFactory factory = faces.getApplication().getExpressionFactory(); valueObj = factory.coerceToType(valueObj, target.getType(el)); } this.target.setValue(el, valueObj); }
private Object coerceToModelType(FacesContext ctx, Object value, Class<? extends Object> itemValueType) { Object newValue; try { ExpressionFactory ef = ctx.getApplication().getExpressionFactory(); newValue = ef.coerceToType(value, itemValueType); } catch (ELException ele) { newValue = value; } catch (IllegalArgumentException iae) { newValue = value; } return newValue; }
public ValidateLengthTag() { super(); if (VALIDATOR_ID_EXPR == null) { FacesContext context = FacesContext.getCurrentInstance(); ExpressionFactory factory = context.getApplication(). getExpressionFactory(); VALIDATOR_ID_EXPR = factory.createValueExpression(context.getELContext(), "javax.faces.Length", String.class); } }
@Override public void processAction(ActionEvent evt) throws AbortProcessingException { FacesContext faces = FacesContext.getCurrentInstance(); ELContext el = faces.getELContext(); Object valueObj = this.value.getValue(el); if (valueObj != null) { ExpressionFactory factory = faces.getApplication().getExpressionFactory(); valueObj = factory.coerceToType(valueObj, target.getType(el)); } this.target.setValue(el, valueObj); }