Examples of MethodExpression


Examples of com.tulskiy.musique.playlist.formatting.tokens.MethodExpression

*/
public class Parser {
    public static Expression parse(String text) {
        text = text.replaceAll("\\s*,\\s*", ",");
        StringTokenizer st = new StringTokenizer(text, "$%,\'[])", true);
        MethodExpression root = new MethodExpression("eval");
        Stack<MethodExpression> stack = new Stack<MethodExpression>();
        stack.push(root);
        try {
            while (st.hasMoreTokens()) {
                String token = st.nextToken();

                if (token.equals("%")) {
                    if (st.hasMoreTokens()) {
                        String s = st.nextToken();
                        s = Character.toUpperCase(s.charAt(0)) + s.substring(1);
                        stack.peek().addExpression(new ParameterExpression(s));
                        if (st.hasMoreTokens() && !st.nextToken().equals("%")) {
                            break;
                        }
                    }
                } else if (token.equals("$")) {
                    if (st.hasMoreTokens()) {
                        String s = st.nextToken();
                        s = s.substring(0, s.length() - 1);
                        MethodExpression m = new MethodExpression(s);
                        stack.peek().addExpression(m);
                        stack.push(m);
                    }
                } else if (token.equals(")") || token.equals("]")) {
                    stack.pop();
                } else if (token.equals(",")) {
                    //ignore
                } else if (token.equals("\'")) {
                    StringBuilder sb = new StringBuilder();
                    while (st.hasMoreTokens()) {
                        String str = st.nextToken();
                        if (str.equals("\'"))
                            break;
                        sb.append(str);
                    }

                    stack.peek().addExpression(new TextExpression(sb.toString()));
                } else if (token.equals("[")) {
                    MethodExpression m = new MethodExpression("notNull");
                    stack.peek().addExpression(m);
                    stack.push(m);
                } else {
                    stack.peek().addExpression(new TextExpression(token));
                }
View Full Code Here

Examples of javax.el.MethodExpression

     *
     * @deprecated Use getActionExpression() instead.
     */
    public MethodBinding getAction()
    {
        MethodExpression actionExpression = getActionExpression();
        if (actionExpression instanceof _MethodBindingToMethodExpression)
        {
            return ((_MethodBindingToMethodExpression) actionExpression)
                    .getMethodBinding();
        }
View Full Code Here

Examples of javax.el.MethodExpression

        }

        if (params == null)
            params = new Class[0];

        MethodExpression methodExpression;

        try
        {
            methodExpression = getExpressionFactory().createMethodExpression(threadELContext(), reference,
                    Object.class, params);
View Full Code Here

Examples of javax.el.MethodExpression

   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);
   }
View Full Code Here

Examples of javax.el.MethodExpression

   {
      String el = toELExpression(expression);
      FacesContext facesContext = getFacesContext();
      ELContext elContext = facesContext.getELContext();
      ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
      MethodExpression methodExpression = expressionFactory.createMethodExpression(elContext, el,
               Object.class, new Class[values.length]);
      return methodExpression.invoke(elContext, values);
   }
View Full Code Here

Examples of javax.el.MethodExpression

        ActionSource as = (ActionSource) parent;

        FaceletContext ctx = (FaceletContext) context.getAttributes().get(TagHandlerUtils.FACELET_CONTEXT_KEY);

        if (this.listenerMethod != null) {
            MethodExpression listenerMethodExpression = this.listenerMethod.getMethodExpression(ctx, Void.TYPE,
                new Class<?>[] { ActionEvent.class });

            as.addActionListener(new MethodExpressionActionListener(listenerMethodExpression));
        } else {
            ValueExpression b = null;
View Full Code Here

Examples of javax.el.MethodExpression

    super.broadcast(event);
   
    FacesContext facesContext = FacesContext.getCurrentInstance();
   
    if(event instanceof org.primefaces.event.CloseEvent) {
      MethodExpression closeMe = getCloseListener();
     
      if(closeMe != null) {
        closeMe.invoke(facesContext.getELContext(), new Object[] {event});
      }
    } else if(event instanceof org.primefaces.event.ToggleEvent) {
      MethodExpression toggleMe = getToggleListener();
     
      if(toggleMe != null) {
        toggleMe.invoke(facesContext.getELContext(), new Object[] {event});
      }
    }
  }
View Full Code Here

Examples of javax.el.MethodExpression

  public void broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException {
    super.broadcast(event);
   
    FacesContext facesContext = FacesContext.getCurrentInstance();
    MethodExpression me = getSelectListener();
   
    if (me != null && event instanceof org.primefaces.event.DateSelectEvent) {
      me.invoke(facesContext.getELContext(), new Object[] {event});
    }
  }
View Full Code Here

Examples of javax.el.MethodExpression

  public void broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException {
    super.broadcast(event);
   
    FacesContext facesContext = FacesContext.getCurrentInstance();
    MethodExpression me = getCloseListener();
   
    if (me != null) {
      me.invoke(facesContext.getELContext(), new Object[] {event});
    }
  }
View Full Code Here

Examples of javax.el.MethodExpression

  public void broadcast(javax.faces.event.FacesEvent event) throws javax.faces.event.AbortProcessingException {
    super.broadcast(event);
   
    FacesContext facesContext = FacesContext.getCurrentInstance();
    MethodExpression me = null;
   
    if(event instanceof ScheduleEntrySelectEvent) me = getEventSelectListener();
    else if(event instanceof DateSelectEvent) me = getDateSelectListener();
    else if(event instanceof ScheduleEntryMoveEvent) me = getEventMoveListener();
    else if(event instanceof ScheduleEntryResizeEvent) me = getEventResizeListener();
   
    if (me != null) {
      me.invoke(facesContext.getELContext(), new Object[] {event});
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.