Package cambridge

Examples of cambridge.ExpressionEvaluationException


         if (property instanceof IdentifierVarProperty) {
            IdentifierVarProperty id = (IdentifierVarProperty) property;
            try {
               object = utils.getBeanProperty(object, id.name);
            } catch (PropertyAccessException e) {
               throw new ExpressionEvaluationException(e);
            }
         } else {
            MapVarProperty m = (MapVarProperty) property;
            if (object instanceof Map) {
               object = ((Map) object).get(m.expression.eval(p));
View Full Code Here


    public Object eval(Map<String, Object> globals) throws ExpressionEvaluationException {
        //VariableResolverFactory factory = new MapVariableResolverFactory(globals);
        try {
            return MVEL.executeExpression(compiledExpression, globals);
        } catch (Exception e) {
            throw new ExpressionEvaluationException("Error evaluating exception on line: " + line + ", column: " + col + ", expression: " + expression, e);
        }
    }
View Full Code Here

   }

   @Override
   public Object eval(Map<String, Object> p, CambridgeExpression[] params) throws ExpressionEvaluationException {
      if (params == null || params.length == 0) {
         throw new ExpressionEvaluationException("Action name error");
      }

      String call = params[0].asString(p);
      String[] action = call.split("\\.");
      String controller = null;
View Full Code Here

   public Object eval(Map<String, Object> globals) throws ExpressionEvaluationException {
      try {
         return Ognl.getValue(parsedExpression, globals, (Object) globals);
      } catch (OgnlException e) {
         throw new ExpressionEvaluationException("Error evaluating expression: " + expression, e);
      }
   }
View Full Code Here

*/
public class IfFunction extends FunctionRunner {
   @Override
   public Object eval(Map<String, Object> p, CambridgeExpression[] params) throws ExpressionEvaluationException {
      if (params.length != 3) {
         throw new ExpressionEvaluationException("Invalid number of arguments for if statement");
      }

      return params[0].asBoolean(p) ? params[1].eval(p) : params[2].eval(p);
   }
View Full Code Here

      return o == null ? Type.Null : Type.Object;
   }

   public Object eval(Map<String, Object> p) throws ExpressionEvaluationException {
      if (runner == null) {
         throw new ExpressionEvaluationException("Unknown function " + functionName);
      }
      return runner.eval(p, parameters);
   }
View Full Code Here

    @Override
    public Object eval(ExpressionContext context, CambridgeExpression[] params) throws ExpressionEvaluationException {
        Class<?>[] parameterTypes = method.getParameterTypes();
        if (parameterTypes != null && (params == null || parameterTypes.length != params.length)) {
            throw new ExpressionEvaluationException("Invalid number of parameters provided for calling static method " + method.toString());
        }

        try {
            if (params == null || params.length == 0) {
                return method.invoke(null);
            }

            Object[] args = new Object[params.length];

            for (int i = 0, paramsLength = params.length; i < paramsLength; i++) {
                CambridgeExpression e = params[i];

                args[i] = e.eval(context);
                if (method.isVarArgs() && i == params.length - 1 && parameterTypes != null && !(parameterTypes[i].isAssignableFrom(args[i].getClass()))) {
                    args[i] = new Object[] {args[i]};
                }
            }

            return method.invoke(null, args);

        } catch (Exception e) {
            throw new ExpressionEvaluationException("Error calling static method " + method.toString(), e);
        }
    }
View Full Code Here

*/
public class IfFunction extends FunctionRunner {
   @Override
   public Object eval(ExpressionContext context, CambridgeExpression[] params) throws ExpressionEvaluationException {
      if (params.length != 3) {
         throw new ExpressionEvaluationException("Invalid number of arguments for if statement");
      }

      return params[0].asBoolean(context) ? params[1].eval(context) : params[2].eval(context);
   }
View Full Code Here

      return o == null ? Type.Null : Type.Object;
   }

   public Object eval(ExpressionContext context) throws ExpressionEvaluationException {
      if (runner == null) {
         throw new ExpressionEvaluationException("Unknown function " + functionName);
      }
      return runner.eval(context, parameters);
   }
View Full Code Here

         if (property instanceof IdentifierVarProperty) {
            IdentifierVarProperty id = (IdentifierVarProperty) property;
            try {
               object = utils.getBeanProperty(object, id.name);
            } catch (PropertyAccessException e) {
               throw new ExpressionEvaluationException(e);
            }
         } else {
            MapVarProperty m = (MapVarProperty) property;
            if (object instanceof Map) {
               object = ((Map<?,?>) object).get(m.expression.eval(context));
View Full Code Here

TOP

Related Classes of cambridge.ExpressionEvaluationException

Copyright © 2018 www.massapicom. 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.