Examples of pickMethod()


Examples of groovy.lang.MetaClass.pickMethod()

      argTypes[i++] = arg == null ? null : arg.getClass();
    }

    MetaClass metaClass = target instanceof Class ? InvokerHelper.getMetaClass((Class) target) : InvokerHelper.getMetaClass(target);

    MetaMethod metaMethod = metaClass.pickMethod(method, argTypes);
    if (metaMethod == null) {
      return false;
    }

    Class returnType = metaMethod.getReturnType();
View Full Code Here

Examples of groovy.lang.MetaClass.pickMethod()

            }
        }

        MetaClass metaclass = InvokerHelper.getMetaClass(self);

        MetaMethod mm = metaclass.pickMethod(name, types);

        // try some simple transformations
        // transform a trailing closure to a function
        if (mm == null && objects.length > 0) {
            Object lastArg = objects[objects.length - 1];
View Full Code Here

Examples of groovy.lang.MetaClass.pickMethod()

        if (mm == null && objects.length > 0) {
            Object lastArg = objects[objects.length - 1];
            if (lastArg instanceof Closure) {
                Class<?>[] at2 = Arrays.copyOf(types, types.length);
                at2[objects.length - 1] = Function.class;
                mm = metaclass.pickMethod(name, at2);
                if (mm != null) {
                    objects[objects.length - 1] new ClosureFunction((Closure) lastArg);
                }
            }
        }
View Full Code Here

Examples of groovy.lang.MetaClass.pickMethod()

        // try instantiating a single class
        if (mm == null && objects.length == 1 && objects[0] instanceof Class) {
            final Class<?> cls = (Class) objects[0];
            Class[] at2 = {cls};
            final MetaMethod method = metaclass.pickMethod(name, at2);

            if (method != null) {
                try {
                    final Constructor ctor = cls.getConstructor();
                    return new Supplier<Object>() {
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.