Package chaschev.lang.reflect

Examples of chaschev.lang.reflect.MethodDesc


    private static Field _getField(Object object, String fieldName) {
        return getClassDesc(object.getClass()).getField(fieldName);
    }

    public static Optional<MethodDesc> getMethod(Object object, String methodName, Object... params) {
        MethodDesc methodDesc = getClassDesc(object.getClass()).getMethodDesc(methodName, false, params);
        return  Optional.fromNullable(methodDesc);
    }
View Full Code Here


        }
    }

    public static Object invokeStatic(Class aClass, String name, Object... args) {
        try {
            final MethodDesc method = OpenBean.getClassDesc(aClass).getStaticMethodDesc(name, false);

            if (method == null) {
                throw new RuntimeException("no such method '" + name + "' " + " in class " + aClass);
            }

            return method.invoke(aClass, args);
        } catch (Exception e) {
            throw Exceptions.runtime(e);
        }
    }
View Full Code Here

        }
    }

    public static Object invoke(Object object, String name, Object... args) {
        try {
            final MethodDesc method = OpenBean.getClassDesc(object.getClass()).getMethodDesc(name, false, args);

            if (method == null) {
                throw new RuntimeException("no such method '" + name + "' " + " in object " + object.getClass());
            }

            return method.invoke(object, args);
        } catch (Exception e) {
            throw Exceptions.runtime(e);
        }
    }
View Full Code Here

                    return null;
                }else{
                    Method _method = method[0];

                    if(_method == null){
                        MethodDesc methodDesc = OpenBean.getClassDesc(input.getClass()).getMethodDesc(methodName, true);

                        Preconditions.checkNotNull(methodDesc, "no such method: " + methodName);

                        _method = method[0] = methodDesc.getMethod();
                    }
                   
                    try {
                        return (RETURN) _method.invoke(input);
                    } catch (Exception e) {
View Full Code Here

    public void invoke(String method, Object... params) {
        Preconditions.checkNotNull(method, "method must not be null");

        setProjectVars();

        MethodDesc methodDesc = OpenBean.getClassDesc(getClass()).getMethodDesc(method, false, params);

        Configuration projectAnnotation = projectConf();
        Configuration methodAnnotation = methodDesc.getMethod().getAnnotation(Configuration.class);

        configureWithAnnotations(methodAnnotation, projectAnnotation);

        global.put(bear.useUI, useUI(firstNonNull(methodAnnotation, projectAnnotation)));

        Object result = methodDesc.invoke(this, params);

        System.out.println("returned result: " + result);
    }
View Full Code Here

    public void invoke(String method, Object... params) {
        Preconditions.checkNotNull(method, "method must not be null");

        setProjectVars();

        MethodDesc methodDesc = OpenBean.getClassDesc(getClass()).getMethodDesc(method, false, params);

        Configuration projectAnnotation = projectConf();
        Configuration methodAnnotation = methodDesc.getMethod().getAnnotation(Configuration.class);

        configureWithAnnotations(methodAnnotation, projectAnnotation);

        global.put(bear.useUI, useUI(firstNonNull(methodAnnotation, projectAnnotation)));

        Object result = methodDesc.invoke(this, params);

        System.out.println("returned result: " + result);
    }
View Full Code Here

TOP

Related Classes of chaschev.lang.reflect.MethodDesc

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.