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}); } } }
String actionExpressionString = menuItem.getCommand(); MethodExpression noArgExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[0]); Object invokeResult = null; try { MethodExpression argExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[]{ActionEvent.class}); createMethodExpression(eLContext, actionExpressionString, String.class, new Class[]{MenuActionEvent.class});
String actionExpressionString = menuItem.getCommand(); MethodExpression noArgExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[0]); Object invokeResult = null; try { MethodExpression argExpr = facesContext.getApplication().getExpressionFactory(). createMethodExpression(eLContext, actionExpressionString, String.class, new Class[]{ActionEvent.class}); createMethodExpression(eLContext, actionExpressionString, String.class, new Class[]{MenuActionEvent.class});
private void initMethodExpression() { if (me == null || ve == null) { me = EL.EXPRESSION_FACTORY.createMethodExpression(elContext, expression, returnType, new Class[0]); } }
@Override public MethodExpressionProvider asMethodExpression(Class<?>[] expectedParamTypes) { methodExpression = expressionFactory.createMethodExpression(context, el, returnType, expectedParamTypes); return this; }
public MethodExpression createMethodExpression(ELContext context, String expression, Class<?> expectedReturnType, Class<?>[] expectedParamTypes) throws ELException { return _factory.createMethodExpression(context, expression, expectedReturnType, expectedParamTypes); }
@Override public MethodExpression createMethodExpression(ELContext arg0, String arg1, Class<?> arg2, Class<?>[] arg3) throws ELException, NullPointerException { return this.expressionFactory.createMethodExpression(arg0, arg1, arg2, arg3); }
@Override public FlowBuilder finalizer(String methodExpression) { MethodExpression me = expressionFactory.createMethodExpression(elContext, methodExpression, null, new Class[] {}); flow.setFinalizer(me); return this; }
public AjaxBehaviorListenerImpl( String listenerExpression ) { FacesContext context = FacesContext.getCurrentInstance(); Application application = context.getApplication(); mListenerMethod = application.getExpressionFactory().createMethodExpression( context.getELContext(), listenerExpression, Object.class, new Class[] { AjaxBehaviorEvent.class } ); }
private MethodExpression getMethodExpression(FacesContext ctx) { if (methodExpression==null) { // In JSF 1.1 EL (argTypes = null) == (argTypes = new Class[0]), but not in Unified EL methodExpression = ctx.getApplication().getExpressionFactory() .createMethodExpression( ctx.getELContext(), expressionString, Object.class, argTypes == null ? new Class[0] : argTypes ); } return methodExpression; } }
@SuppressWarnings("unchecked") public <T> T evaluateMethodExpression(BeanManager beanManager, String expression, Class<T> expectedType, Class<?>[] expectedParamTypes, Object[] expectedParams) { ELContext elContext = createELContext(beanManager); return (T) EXPRESSION_FACTORY.createMethodExpression(elContext, expression, expectedType, expectedParamTypes).invoke( elContext, expectedParams); }
@Override public FlowBuilder initializer(String methodExpression) { Util.notNull("methodExpression", methodExpression); MethodExpression me = expressionFactory.createMethodExpression(elContext, methodExpression, null, new Class[] {}); flow.setInitializer(me); return this; }
@Override public FlowBuilder initializer(String methodExpression) { Util.notNull("methodExpression", methodExpression); MethodExpression me = expressionFactory.createMethodExpression(elContext, methodExpression, null, new Class[] {}); flow.setInitializer(me); return this; }
@Override public FlowBuilder initializer(String methodExpression) { Util.notNull("methodExpression", methodExpression); MethodExpression me = expressionFactory.createMethodExpression(elContext, methodExpression, null, new Class[] {}); flow.setInitializer(me); return this; }
public MethodExpression createMethodExpression(String methodExpression, Class[] paramTypes) { FacesContext facesContext = getFacesContext(); return facesContext.getApplication().getExpressionFactory().createMethodExpression( facesContext.getELContext(), methodExpression, null, paramTypes); }
@Override public MethodCallBuilder expression(String methodExpression) { ELContext elc = root.getELContext(); MethodExpression me = root.getExpressionFactory().createMethodExpression(elc, methodExpression, null, EMPTY_ARGS); methodCallNode.setMethodExpression(me); return this; }
public Object invokeMethod(final FacesContext context, final String expression, Class<?>[] argumentTypes, Object[] argumentValues) throws ELException { ExpressionFactory ef = context.getApplication().getExpressionFactory(); MethodExpression me = ef.createMethodExpression(context.getELContext(), expression, Object.class, argumentTypes); return me.invoke(context.getELContext(), argumentValues); }
@Override public MethodCallBuilder expression(String methodExpression, Class[] paramTypes) { ELContext elc = root.getELContext(); MethodExpression me = root.getExpressionFactory().createMethodExpression(elc, methodExpression, null, paramTypes); methodCallNode.setMethodExpression(me); return this; }
/** * Call a method binding */ protected Object invokeMethod(String methodExpression) { return application.getExpressionFactory().createMethodExpression(facesContext.getELContext(), methodExpression, Object.class, new Class[0]).invoke(facesContext.getELContext(), null); }
public void applyMetadata(FaceletContext ctx, Object instance) { ExpressionFactory expressionFactory = ctx.getExpressionFactory(); MethodExpression methodExpressionOneArg = attr.getMethodExpression( ctx, null, ActionSourceRule.ACTION_LISTENER_SIG); MethodExpression methodExpressionZeroArg = expressionFactory.createMethodExpression( ctx, methodExpressionOneArg.getExpressionString(), Void.class, ActionSourceRule.ACTION_LISTENER_ZEROARG_SIG); ((ActionSource2) instance) .addActionListener(new MethodExpressionActionListener( methodExpressionOneArg, methodExpressionZeroArg)); }