Package net.sf.cglib.reflect

Examples of net.sf.cglib.reflect.FastMethod


    checkArgumentTypes(args);
    return invokable.invoke(args);
  }
 
  private static FastMethod mapMethod(Class<?> type) {
    FastMethod method = mapMethods.get(type);
    if (method == null) {
      method = introspectMapperMethod(type);
      mapMethods.put(type, method);
    }
    return method;
View Full Code Here


            if (methodTarget != null) {
                try
                {
                    // find descriptor again, allow for duck typing
                    ExprNodeUtilMethodDesc desc = getValidateMethodDescriptor(methodTarget, chainElement.getName(), chainElement.getParameters(), validationContext);
                    FastMethod fastMethod = desc.getFastMethod();
                    paramEvals = desc.getChildEvals();

                    ExprDotEval eval;
                    if (currentInputType instanceof ClassEPType) {
                        // if followed by an enumeration method, convert array to collection
                        if (fastMethod.getReturnType().isArray() && !chainSpecStack.isEmpty() && EnumMethodEnum.isEnumerationMethod(chainSpecStack.getFirst().getName())) {
                            eval = new ExprDotMethodEvalNoDuckWrapArray(validationContext.getStatementName(), fastMethod, paramEvals);
                        }
                        else {
                            eval = new ExprDotMethodEvalNoDuck(validationContext.getStatementName(), fastMethod, paramEvals);
                        }
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

        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, true));
        }

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

        ActionEventAdapter adapter = new ActionEventAdapter(moduleObject, fastHandlers, getMethodInvoker(preHandler,
                                                                                                         moduleInfo, false), getMethodInvoker(postHanlder, moduleInfo, false));

        try {
View Full Code Here

     */
    public static FastMethod getMethod(Class<?> clazz, String methodName, Class... parameterTypes) {
        String clazzName = clazz.getName();
        String methodKey = clazzName + "#" + methodName;

        FastMethod method = fastMethodCache.get(methodKey);
        if (null == method) {
            FastClass fc = fastClassCache.get(clazzName);
            if (null == fc) {
                fc = FastClass.create(clazz);
                fastClassCache.put(clazzName, fc);
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

        private CallOverrider(Object overrider) {
            this.overrider = overrider;
        }

        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

        Class<?> moduleClass = moduleObject.getClass();
        Method executeMethod = getMethod(moduleClass, "execute");

        if (executeMethod != null) {
            FastClass fc = FastClass.create(moduleClass);
            FastMethod fm = fc.getMethod(executeMethod);

            // 对于action,可被“跳过”执行。
            boolean skippable = "action".equalsIgnoreCase(type);

            return new DataBindingAdapter(moduleObject, getMethodInvoker(fm, moduleInfo, skippable));
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.