|
|
|
@ -104,17 +104,16 @@ public class StandardEvaluationContext implements EvaluationContext { |
|
|
|
return this.constructorResolvers.remove(resolver); |
|
|
|
return this.constructorResolvers.remove(resolver); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setConstructorResolvers(List<ConstructorResolver> constructorResolvers) { |
|
|
|
|
|
|
|
this.constructorResolvers = constructorResolvers; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<ConstructorResolver> getConstructorResolvers() { |
|
|
|
public List<ConstructorResolver> getConstructorResolvers() { |
|
|
|
ensureConstructorResolversInitialized(); |
|
|
|
ensureConstructorResolversInitialized(); |
|
|
|
return this.constructorResolvers; |
|
|
|
return this.constructorResolvers; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setConstructorResolvers(List<ConstructorResolver> constructorResolvers) { |
|
|
|
|
|
|
|
this.constructorResolvers = constructorResolvers; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void addMethodResolver(MethodResolver resolver) { |
|
|
|
public void addMethodResolver(MethodResolver resolver) { |
|
|
|
ensureMethodResolversInitialized(); |
|
|
|
ensureMethodResolversInitialized(); |
|
|
|
this.methodResolvers.add(this.methodResolvers.size() - 1, resolver); |
|
|
|
this.methodResolvers.add(this.methodResolvers.size() - 1, resolver); |
|
|
|
@ -125,6 +124,10 @@ public class StandardEvaluationContext implements EvaluationContext { |
|
|
|
return this.methodResolvers.remove(methodResolver); |
|
|
|
return this.methodResolvers.remove(methodResolver); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setMethodResolvers(List<MethodResolver> methodResolvers) { |
|
|
|
|
|
|
|
this.methodResolvers = methodResolvers; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<MethodResolver> getMethodResolvers() { |
|
|
|
public List<MethodResolver> getMethodResolvers() { |
|
|
|
ensureMethodResolversInitialized(); |
|
|
|
ensureMethodResolversInitialized(); |
|
|
|
@ -140,11 +143,6 @@ public class StandardEvaluationContext implements EvaluationContext { |
|
|
|
return this.beanResolver; |
|
|
|
return this.beanResolver; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setMethodResolvers(List<MethodResolver> methodResolvers) { |
|
|
|
|
|
|
|
this.methodResolvers = methodResolvers; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void addPropertyAccessor(PropertyAccessor accessor) { |
|
|
|
public void addPropertyAccessor(PropertyAccessor accessor) { |
|
|
|
ensurePropertyAccessorsInitialized(); |
|
|
|
ensurePropertyAccessorsInitialized(); |
|
|
|
this.propertyAccessors.add(this.propertyAccessors.size() - 1, accessor); |
|
|
|
this.propertyAccessors.add(this.propertyAccessors.size() - 1, accessor); |
|
|
|
@ -154,17 +152,16 @@ public class StandardEvaluationContext implements EvaluationContext { |
|
|
|
return this.propertyAccessors.remove(accessor); |
|
|
|
return this.propertyAccessors.remove(accessor); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setPropertyAccessors(List<PropertyAccessor> propertyAccessors) { |
|
|
|
|
|
|
|
this.propertyAccessors = propertyAccessors; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<PropertyAccessor> getPropertyAccessors() { |
|
|
|
public List<PropertyAccessor> getPropertyAccessors() { |
|
|
|
ensurePropertyAccessorsInitialized(); |
|
|
|
ensurePropertyAccessorsInitialized(); |
|
|
|
return this.propertyAccessors; |
|
|
|
return this.propertyAccessors; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setPropertyAccessors(List<PropertyAccessor> propertyAccessors) { |
|
|
|
|
|
|
|
this.propertyAccessors = propertyAccessors; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setTypeLocator(TypeLocator typeLocator) { |
|
|
|
public void setTypeLocator(TypeLocator typeLocator) { |
|
|
|
Assert.notNull(typeLocator, "TypeLocator must not be null"); |
|
|
|
Assert.notNull(typeLocator, "TypeLocator must not be null"); |
|
|
|
this.typeLocator = typeLocator; |
|
|
|
this.typeLocator = typeLocator; |
|
|
|
@ -232,10 +229,8 @@ public class StandardEvaluationContext implements EvaluationContext { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Register a {@code MethodFilter} which will be called during method resolution |
|
|
|
* Register a {@code MethodFilter} which will be called during method resolution |
|
|
|
* for the specified type. |
|
|
|
* for the specified type. |
|
|
|
* |
|
|
|
|
|
|
|
* <p>The {@code MethodFilter} may remove methods and/or sort the methods which |
|
|
|
* <p>The {@code MethodFilter} may remove methods and/or sort the methods which |
|
|
|
* will then be used by SpEL as the candidates to look through for a match. |
|
|
|
* will then be used by SpEL as the candidates to look through for a match. |
|
|
|
* |
|
|
|
|
|
|
|
* @param type the type for which the filter should be called |
|
|
|
* @param type the type for which the filter should be called |
|
|
|
* @param filter a {@code MethodFilter}, or {@code null} to unregister a filter for the type |
|
|
|
* @param filter a {@code MethodFilter}, or {@code null} to unregister a filter for the type |
|
|
|
* @throws IllegalStateException if the {@link ReflectiveMethodResolver} is not in use |
|
|
|
* @throws IllegalStateException if the {@link ReflectiveMethodResolver} is not in use |
|
|
|
@ -244,7 +239,8 @@ public class StandardEvaluationContext implements EvaluationContext { |
|
|
|
ensureMethodResolversInitialized(); |
|
|
|
ensureMethodResolversInitialized(); |
|
|
|
if (this.reflectiveMethodResolver != null) { |
|
|
|
if (this.reflectiveMethodResolver != null) { |
|
|
|
this.reflectiveMethodResolver.registerMethodFilter(type, filter); |
|
|
|
this.reflectiveMethodResolver.registerMethodFilter(type, filter); |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
throw new IllegalStateException("Method filter cannot be set as the reflective method resolver is not in use"); |
|
|
|
throw new IllegalStateException("Method filter cannot be set as the reflective method resolver is not in use"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -272,7 +268,8 @@ public class StandardEvaluationContext implements EvaluationContext { |
|
|
|
private synchronized void initializeMethodResolvers() { |
|
|
|
private synchronized void initializeMethodResolvers() { |
|
|
|
if (this.methodResolvers == null) { |
|
|
|
if (this.methodResolvers == null) { |
|
|
|
List<MethodResolver> defaultResolvers = new ArrayList<MethodResolver>(); |
|
|
|
List<MethodResolver> defaultResolvers = new ArrayList<MethodResolver>(); |
|
|
|
defaultResolvers.add(this.reflectiveMethodResolver = new ReflectiveMethodResolver()); |
|
|
|
this.reflectiveMethodResolver = new ReflectiveMethodResolver(); |
|
|
|
|
|
|
|
defaultResolvers.add(this.reflectiveMethodResolver); |
|
|
|
this.methodResolvers = defaultResolvers; |
|
|
|
this.methodResolvers = defaultResolvers; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|