Package net.sf.cglib.reflect

Examples of net.sf.cglib.reflect.FastMethod


        ModuleInfo moduleInfo = new ModuleInfo(type, name);
        FastClass fc = FastClass.create(moduleClass);
        Map<String, MethodInvoker> fastHandlers = createHashMap(handlers.size());

        for (Map.Entry<String, Method> entry : handlers.entrySet()) {
            FastMethod fm = fc.getMethod(entry.getValue());
            fastHandlers.put(entry.getKey(), getMethodInvoker(fm, moduleInfo, isEventHandlerSkippable()));
        }

        FastMethod preHandler = getFastMethod(fc, PRE_HANDLER);
        FastMethod postHanlder = getFastMethod(fc, POST_HANDLER);

        AbstractModuleEventAdapter adapter = createAdapter(moduleObject,
                                                           fastHandlers,
                                                           getMethodInvoker(preHandler, moduleInfo, false),
                                                           getMethodInvoker(postHanlder, moduleInfo, false));
View Full Code Here


                // proxied callback
                new MethodInterceptor() {
                    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
                            throws Throwable {
                        FastMethod realMethod = assertNotNull(methodMappings.get(method), "unknown method: %s", method);
                        return realMethod.invoke(null, args);
                    }
                } });

        generator.setCallbackFilter(new CallbackFilter() {
            public int accept(Method method) {
View Full Code Here

        for (Method method : intfs.getMethods()) {
            Signature sig = getSignature(method, null);
            Method realMethod = assertNotNull(methods.get(sig), "unknown method signature: %s", sig);
            FastClass fc = FastClass.create(getClassLoader(), realMethod.getDeclaringClass());
            FastMethod fm = fc.getMethod(realMethod);

            methodMappings.put(method, fm);
        }

        return methodMappings;
View Full Code Here

                    // callback 2: invoke overrided method
                    new MethodInterceptor() {
                        public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
                                throws Throwable {
                            FastMethod overridedMethod = overridedMethods.get(getSignature(method, null));

                            try {
                                return overridedMethod.invoke(overrider, args);
                            } catch (InvocationTargetException e) {
                                throw e.getTargetException();
                            }
                        }
                    } });
View Full Code Here

        public <T> MethodInfo(Class<T> returnValueType, T defaultReturnValue, Class<?> declaringClass, String methodName, Class<?>... parameterTypes) {
            this.returnValueType = returnValueType;
            this.defaultReturnValue = defaultReturnValue;

            Method javaMethod;
            FastMethod method = null;

            if (declaringClass != null) {
                try {
                    javaMethod = declaringClass.getMethod(methodName, parameterTypes);
                    method = FastClass.create(getClass().getClassLoader(), declaringClass).getMethod(javaMethod);
View Full Code Here

                // proxied callback
                new MethodInterceptor() {
                    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
                            throws Throwable {
                        FastMethod realMethod = assertNotNull(methodMappings.get(method), "unknown method: %s", method);
                        return realMethod.invoke(null, args);
                    }
                } });

        generator.setCallbackFilter(new CallbackFilter() {
            public int accept(Method method) {
View Full Code Here

        for (Method method : intfs.getMethods()) {
            Signature sig = getSignature(method, null);
            Method realMethod = assertNotNull(methods.get(sig), "unknown method signature: %s", sig);
            FastClass fc = FastClass.create(getClassLoader(), realMethod.getDeclaringClass());
            FastMethod fm = fc.getMethod(realMethod);

            methodMappings.put(method, fm);
        }

        return methodMappings;
View Full Code Here

    public Object evaluate(Object target, EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext) {
        if (target == null) {
            return null;
        }

        FastMethod method;
        if (cache.containsKey(target.getClass())) {
            method = cache.get(target.getClass());
        }
        else {
            method = getFastMethod(target.getClass());
            cache.put(target.getClass(), method);
        }

        if (method == null) {
            return null;
        }

    Object[] args = new Object[parameters.length];
    for(int i = 0; i < args.length; i++)
    {
      args[i] = parameters[i].evaluate(eventsPerStream, isNewData, exprEvaluatorContext);
    }

    try
    {
            return method.invoke(target, args);
    }
    catch (InvocationTargetException e)
    {
            String message = JavaClassHelper.getMessageInvocationTarget(statementName, method.getJavaMethod(), target.getClass().getName(), args, e);
            log.error(message, e.getTargetException());
    }
        return null;
    }
View Full Code Here

                    else {
                        target = currentInputType.getEventType().getUnderlyingType();
                    }
                    Method method = validationContext.getMethodResolutionService().resolveMethod(target, chainElement.getName(), paramTypes);
                    FastClass declaringClass = FastClass.create(Thread.currentThread().getContextClassLoader(), method.getDeclaringClass());
                    FastMethod fastMethod = declaringClass.getMethod(method);

                    ExprDotEval eval;
                    if (currentInputType.isScalar()) {
                        eval = new ExprDotMethodEvalNoDuck(validationContext.getStatementName(), fastMethod, paramEvals);
                    }
View Full Code Here

                allConstants = false;
            }
        }

        // Try to resolve the method
        final FastMethod staticMethod;
        Method method;
        try
        {
            method = methodResolutionService.resolveMethod(className, methodName, paramTypes);
            FastClass declaringClass = FastClass.create(Thread.currentThread().getContextClassLoader(), method.getDeclaringClass());
View Full Code Here

TOP

Related Classes of net.sf.cglib.reflect.FastMethod

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.