Java 类org.springframework.context.expression.MethodBasedEvaluationContext 实例源码

项目:spring4-understanding    文件:EventExpressionEvaluator.java   
/**
 * Create the suitable {@link EvaluationContext} for the specified event handling
 * on the specified method.
 */
public EvaluationContext createEvaluationContext(ApplicationEvent event, Class<?> targetClass,
        Method method, Object[] args) {

    Method targetMethod = getTargetMethod(targetClass, method);
    EventExpressionRootObject root = new EventExpressionRootObject(event, args);
    return new MethodBasedEvaluationContext(root, targetMethod, args, this.paramNameDiscoverer);
}
项目:spring    文件:EventExpressionEvaluator.java   
/**
 * Create the suitable {@link EvaluationContext} for the specified event handling
 * on the specified method.
 */
public EvaluationContext createEvaluationContext(ApplicationEvent event, Class<?> targetClass,
        Method method, Object[] args, BeanFactory beanFactory) {

    Method targetMethod = getTargetMethod(targetClass, method);
    EventExpressionRootObject root = new EventExpressionRootObject(event, args);
    MethodBasedEvaluationContext evaluationContext = new MethodBasedEvaluationContext(
            root, targetMethod, args, getParameterNameDiscoverer());
    if (beanFactory != null) {
        evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
    }
    return evaluationContext;
}
项目:spring-distributelock    文件:LockExpressionEvaluator.java   
/**
 * Create an {@link EvaluationContext}.
 *
 * @param locks
 *            the current locks
 * @param method
 *            the method
 * @param args
 *            the method arguments
 * @param target
 *            the target object
 * @param targetClass
 *            the target class
 * @return the evaluation context
 */
public EvaluationContext createEvaluationContext(Collection<? extends Lock> locks, Object target, Class<?> targetClass, Method method,
                                                 Object[] args) {

    LockExpressionRootObject rootObject = new LockExpressionRootObject(locks, method, args, target, targetClass);
    Method targetMethod = getTargetMethod(targetClass, method);
    MethodBasedEvaluationContext evaluationContext = new MethodBasedEvaluationContext(rootObject, targetMethod, args,
            this.paramNameDiscoverer);
    return evaluationContext;
}