Package org.apache.commons.jexl.util.introspection

Examples of org.apache.commons.jexl.util.introspection.VelMethod


            // check if there is a size method on the object that returns an
            // integer
            // and if so, just use it
            Object[] params = new Object[0];
            Info velInfo = new Info("", 1, 1);
            VelMethod vm = Introspector.getUberspect().getMethod(val, "size", params, velInfo);
            if (vm != null && vm.getReturnType() == Integer.TYPE) {
                Integer result = (Integer) vm.invoke(val, params);
                return result.intValue();
            }
            throw new Exception("size() : unknown type : " + val.getClass());
        }
    }
View Full Code Here


        try {
            for (int i = 0; i < paramCount; i++) {
                params[i] = ((SimpleNode) jjtGetChild(i + 1)).value(jc);
            }

            VelMethod vm = Introspector.getUberspect().getMethod(obj, methodName, params, DUMMY);
            /*
             * DG: If we can't find an exact match, narrow the parameters and
             * try again!
             */
            if (vm == null) {

                // replace all numbers with the smallest type that will fit
                for (int i = 0; i < params.length; i++) {
                    Object param = params[i];
                    if (param instanceof Number) {
                        params[i] = narrow((Number) param);
                    }
                }
                vm = Introspector.getUberspect().getMethod(obj, methodName, params, DUMMY);
                if (vm == null) {
                    return null;
                }
            }

            return vm.invoke(obj, params);
        } catch (InvocationTargetException e) {
            Throwable t = e.getTargetException();

            if (t instanceof Exception) {
                throw (Exception) t;
View Full Code Here

        else {
          // check if there is a size method on the object that returns an integer
          // and if so, just use it
          Object[] params = new Object[0];
          Info velInfo = new Info("",1,1);
            VelMethod vm = Introspector.getUberspect().getMethod(val, "size", params, velInfo);
            if (vm != null && vm.getReturnType() == Integer.TYPE)
            {
              Integer result = (Integer)vm.invoke(val, params);
              return result.intValue();
            }
            else
            {
                throw new Exception("size() : unknown type : " + val.getClass());
View Full Code Here

            for (int i=0; i<paramCount; i++)
            {
                params[i] = ( (SimpleNode) jjtGetChild(i+1)).value(jc);
            }

            VelMethod vm = Introspector.getUberspect().getMethod(obj, methodName, params, DUMMY);

            if (vm == null)
                return null;

            return vm.invoke(obj, params);
        }
        catch(InvocationTargetException e)
        {
            Throwable t = e.getTargetException();
View Full Code Here

TOP

Related Classes of org.apache.commons.jexl.util.introspection.VelMethod

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.