Examples of MethodKey


Examples of org.apache.commons.jexl2.internal.introspection.MethodKey

        assertTrue(out != null);
    }
   
    public void testObjectKey() throws Exception {
        for(int k = 0; k < keyList.length; ++k) {
            MethodKey ctl = keyList[k];
            MethodKey key = makeKey(ctl.getMethod(), ctl.getParameters());
            String out = byKey.get(key);
            assertTrue(out != null);
            assertTrue(ctl.toString() + " != " + out, ctl.toString().equals(out));
        }
       
View Full Code Here

Examples of org.apache.commons.jexl2.internal.introspection.MethodKey

       
    }
   
    public void testStringKey() throws Exception {
        for(int k = 0; k < keyList.length; ++k) {
            MethodKey ctl = keyList[k];
            String key = makeStringKey(ctl.getMethod(), ctl.getParameters());
            MethodKey out = byString.get(key);
            assertTrue(out != null);
            assertTrue(ctl.toString() + " != " + key, ctl.equals(out));
        }
       
    }
View Full Code Here

Examples of org.apache.commons.jexl2.internal.introspection.MethodKey

    private static final int LOOP = 3;//00;
   
    public void testPerfKey() throws Exception {
        for(int l = 0; l < LOOP; ++l)
        for(int k = 0; k < keyList.length; ++k) {
            MethodKey ctl = keyList[k];
            MethodKey key = makeKey(ctl.getMethod(), ctl.getParameters());
            String out = byKey.get(key);
            assertTrue(out != null);
        }
    }
View Full Code Here

Examples of org.apache.commons.jexl2.internal.introspection.MethodKey

    }
   
    public void testPerfString() throws Exception {
        for(int l = 0; l < LOOP; ++l)
        for(int k = 0; k < keyList.length; ++k) {
            MethodKey ctl = keyList[k];
            String key = makeStringKey(ctl.getMethod(), ctl.getParameters());
            MethodKey out = byString.get(key);
            assertTrue(out != null);
        }
    }
View Full Code Here

Examples of org.apache.commons.jexl2.internal.introspection.MethodKey

    }

    /** {@inheritDoc} */
    @Override
    public Object tryExecute(String name, Object obj, Object[] args) {
        MethodKey tkey = new MethodKey(name, args);
        // let's assume that invocation will fly if the declaring class is the
        // same and arguments have the same type
        if (objectClass.equals(obj.getClass()) && tkey.equals(key)) {
            try {
                return execute(obj, args);
            } catch (InvocationTargetException xinvoke) {
                return TRY_FAILED; // fail
            } catch (IllegalAccessException xill) {
View Full Code Here

Examples of org.apache.commons.jexl2.internal.introspection.MethodKey

     * @return a filled up parameter (may contain a null method)
     */
    private static Parameter discover(Introspector is,
            Object obj, String method, Object[] args) {
        final Class<?> clazz = obj.getClass();
        final MethodKey key = new MethodKey(method, args);
        java.lang.reflect.Method m = is.getMethod(clazz, key);
        if (m == null && clazz.isArray()) {
            // check for support via our array->list wrapper
            m = is.getMethod(ArrayListWrapper.class, key);
        }
View Full Code Here

Examples of org.apache.commons.jexl2.internal.introspection.MethodKey

     *
     * @return a {@link java.lang.reflect.Method}
     *  or null if no unambiguous method could be found through introspection.
     */
    public final Method getMethod(Class<?> c, String name, Object[] params) {
        return base().getMethod(c, new MethodKey(name, params));
    }
View Full Code Here

Examples of org.apache.commons.jexl2.internal.introspection.MethodKey

        } else if (ctorHandle != null) {
            className = ctorHandle.toString();
        } else {
            return null;
        }
        return base().getConstructor(clazz, new MethodKey(className, args));
    }
View Full Code Here

Examples of org.apache.commons.jexl2.internal.introspection.MethodKey

                final Object[] args = {key};
                final Method jm;
                if (getters.length == 1) {
                    jm = getters[0];
                } else {
                    jm = new MethodKey(getters[0].getName(), args).getMostSpecificMethod(Arrays.asList(getters));
                }
                if (jm != null) {
                    return jm.invoke(object, args);
                }
            }
View Full Code Here

Examples of org.apache.commons.jexl2.internal.introspection.MethodKey

                final Object[] args = {key, value};
                final Method jm;
                if (setters.length == 1) {
                    jm = setters[0];
                } else {
                    jm = new MethodKey(setters[0].getName(), args).getMostSpecificMethod(Arrays.asList(setters));
                }
                if (jm != null) {
                    return jm.invoke(object, args);
                }
            }
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.