Add @Override annotations to main sources

Issue: SPR-10130
This commit is contained in:
Chris Beams
2012-12-28 14:00:16 +01:00
parent 9c2046c3ee
commit 3b40ce76bf
1256 changed files with 5716 additions and 0 deletions

View File

@@ -62,14 +62,17 @@ public interface ParserContext {
*/
public static final ParserContext TEMPLATE_EXPRESSION = new ParserContext() {
@Override
public String getExpressionPrefix() {
return "#{";
}
@Override
public String getExpressionSuffix() {
return "}";
}
@Override
public boolean isTemplate() {
return true;
}

View File

@@ -50,10 +50,12 @@ public class CompositeStringExpression implements Expression {
}
@Override
public final String getExpressionString() {
return this.expressionString;
}
@Override
public String getValue() throws EvaluationException {
StringBuilder sb = new StringBuilder();
for (Expression expression : this.expressions) {
@@ -65,6 +67,7 @@ public class CompositeStringExpression implements Expression {
return sb.toString();
}
@Override
public String getValue(Object rootObject) throws EvaluationException {
StringBuilder sb = new StringBuilder();
for (Expression expression : this.expressions) {
@@ -76,6 +79,7 @@ public class CompositeStringExpression implements Expression {
return sb.toString();
}
@Override
public String getValue(EvaluationContext context) throws EvaluationException {
StringBuilder sb = new StringBuilder();
for (Expression expression : this.expressions) {
@@ -87,6 +91,7 @@ public class CompositeStringExpression implements Expression {
return sb.toString();
}
@Override
public String getValue(EvaluationContext context, Object rootObject) throws EvaluationException {
StringBuilder sb = new StringBuilder();
for (Expression expression : this.expressions) {
@@ -98,36 +103,44 @@ public class CompositeStringExpression implements Expression {
return sb.toString();
}
@Override
public Class getValueType(EvaluationContext context) {
return String.class;
}
@Override
public Class getValueType() {
return String.class;
}
@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context) {
return TypeDescriptor.valueOf(String.class);
}
@Override
public TypeDescriptor getValueTypeDescriptor() {
return TypeDescriptor.valueOf(String.class);
}
@Override
public void setValue(EvaluationContext context, Object value) throws EvaluationException {
throw new EvaluationException(this.expressionString, "Cannot call setValue on a composite expression");
}
@Override
public <T> T getValue(EvaluationContext context, Class<T> expectedResultType) throws EvaluationException {
Object value = getValue(context);
return ExpressionUtils.convert(context, value, expectedResultType);
}
@Override
public <T> T getValue(Class<T> expectedResultType) throws EvaluationException {
Object value = getValue();
return ExpressionUtils.convert(null, value, expectedResultType);
}
@Override
public boolean isWritable(EvaluationContext context) {
return false;
}
@@ -137,45 +150,55 @@ public class CompositeStringExpression implements Expression {
}
@Override
public <T> T getValue(Object rootObject, Class<T> desiredResultType) throws EvaluationException {
Object value = getValue(rootObject);
return ExpressionUtils.convert(null, value, desiredResultType);
}
@Override
public <T> T getValue(EvaluationContext context, Object rootObject, Class<T> desiredResultType)
throws EvaluationException {
Object value = getValue(context,rootObject);
return ExpressionUtils.convert(context, value, desiredResultType);
}
@Override
public Class getValueType(Object rootObject) throws EvaluationException {
return String.class;
}
@Override
public Class getValueType(EvaluationContext context, Object rootObject) throws EvaluationException {
return String.class;
}
@Override
public TypeDescriptor getValueTypeDescriptor(Object rootObject) throws EvaluationException {
return TypeDescriptor.valueOf(String.class);
}
@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject) throws EvaluationException {
return TypeDescriptor.valueOf(String.class);
}
@Override
public boolean isWritable(EvaluationContext context, Object rootObject) throws EvaluationException {
return false;
}
@Override
public void setValue(EvaluationContext context, Object rootObject, Object value) throws EvaluationException {
throw new EvaluationException(this.expressionString, "Cannot call setValue on a composite expression");
}
@Override
public boolean isWritable(Object rootObject) throws EvaluationException {
return false;
}
@Override
public void setValue(Object rootObject, Object value) throws EvaluationException {
throw new EvaluationException(this.expressionString, "Cannot call setValue on a composite expression");
}

View File

@@ -41,98 +41,121 @@ public class LiteralExpression implements Expression {
}
@Override
public final String getExpressionString() {
return this.literalValue;
}
@Override
public String getValue() {
return this.literalValue;
}
@Override
public String getValue(EvaluationContext context) {
return this.literalValue;
}
@Override
public String getValue(Object rootObject) {
return this.literalValue;
}
@Override
public Class getValueType(EvaluationContext context) {
return String.class;
}
@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context) {
return TypeDescriptor.valueOf(String.class);
}
@Override
public TypeDescriptor getValueTypeDescriptor() {
return TypeDescriptor.valueOf(String.class);
}
@Override
public void setValue(EvaluationContext context, Object value) throws EvaluationException {
throw new EvaluationException(literalValue, "Cannot call setValue() on a LiteralExpression");
}
@Override
public <T> T getValue(EvaluationContext context, Class<T> expectedResultType) throws EvaluationException {
Object value = getValue(context);
return ExpressionUtils.convert(context, value, expectedResultType);
}
@Override
public <T> T getValue(Class<T> expectedResultType) throws EvaluationException {
Object value = getValue();
return ExpressionUtils.convert(null, value, expectedResultType);
}
@Override
public boolean isWritable(EvaluationContext context) {
return false;
}
@Override
public Class getValueType() {
return String.class;
}
@Override
public <T> T getValue(Object rootObject, Class<T> desiredResultType) throws EvaluationException {
Object value = getValue(rootObject);
return ExpressionUtils.convert(null, value, desiredResultType);
}
@Override
public String getValue(EvaluationContext context, Object rootObject) throws EvaluationException {
return this.literalValue;
}
@Override
public <T> T getValue(EvaluationContext context, Object rootObject, Class<T> desiredResultType) throws EvaluationException {
Object value = getValue(context, rootObject);
return ExpressionUtils.convert(null, value, desiredResultType);
}
@Override
public Class getValueType(Object rootObject) throws EvaluationException {
return String.class;
}
@Override
public Class getValueType(EvaluationContext context, Object rootObject) throws EvaluationException {
return String.class;
}
@Override
public TypeDescriptor getValueTypeDescriptor(Object rootObject) throws EvaluationException {
return TypeDescriptor.valueOf(String.class);
}
@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject) throws EvaluationException {
return TypeDescriptor.valueOf(String.class);
}
@Override
public boolean isWritable(EvaluationContext context, Object rootObject) throws EvaluationException {
return false;
}
@Override
public void setValue(EvaluationContext context, Object rootObject, Object value) throws EvaluationException {
throw new EvaluationException(literalValue, "Cannot call setValue() on a LiteralExpression");
}
@Override
public boolean isWritable(Object rootObject) throws EvaluationException {
return false;
}
@Override
public void setValue(Object rootObject, Object value) throws EvaluationException {
throw new EvaluationException(literalValue, "Cannot call setValue() on a LiteralExpression");
}

View File

@@ -40,22 +40,27 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser
* Default ParserContext instance for non-template expressions.
*/
private static final ParserContext NON_TEMPLATE_PARSER_CONTEXT = new ParserContext() {
@Override
public String getExpressionPrefix() {
return null;
}
@Override
public String getExpressionSuffix() {
return null;
}
@Override
public boolean isTemplate() {
return false;
}
};
@Override
public Expression parseExpression(String expressionString) throws ParseException {
return parseExpression(expressionString, NON_TEMPLATE_PARSER_CONTEXT);
}
@Override
public Expression parseExpression(String expressionString, ParserContext context) throws ParseException {
if (context == null) {
context = NON_TEMPLATE_PARSER_CONTEXT;

View File

@@ -50,14 +50,17 @@ public class TemplateParserContext implements ParserContext {
}
@Override
public final boolean isTemplate() {
return true;
}
@Override
public final String getExpressionPrefix() {
return this.expressionPrefix;
}
@Override
public final String getExpressionSuffix() {
return this.expressionSuffix;
}

View File

@@ -32,6 +32,7 @@ public class InternalParseException extends RuntimeException {
super(cause);
}
@Override
public SpelParseException getCause() {
return (SpelParseException) super.getCause();
}

View File

@@ -105,16 +105,19 @@ public class Indexer extends SpelNodeImpl {
this.typeDescriptor = typeDescriptor;
}
@Override
public TypedValue getValue() {
Object arrayElement = accessArrayElement(this.array, this.idx);
return new TypedValue(arrayElement, this.typeDescriptor.elementTypeDescriptor(arrayElement));
}
@Override
public void setValue(Object newValue) {
setArrayElement(this.typeConverter, this.array, this.idx, newValue,
this.typeDescriptor.getElementTypeDescriptor().getType());
}
@Override
public boolean isWritable() {
return true;
}
@@ -139,11 +142,13 @@ public class Indexer extends SpelNodeImpl {
this.mapEntryTypeDescriptor = mapEntryTypeDescriptor;
}
@Override
public TypedValue getValue() {
Object value = this.map.get(this.key);
return new TypedValue(value, this.mapEntryTypeDescriptor.getMapValueTypeDescriptor(value));
}
@Override
public void setValue(Object newValue) {
if (this.mapEntryTypeDescriptor.getMapValueTypeDescriptor() != null) {
newValue = this.typeConverter.convertValue(newValue, TypeDescriptor.forObject(newValue),
@@ -152,6 +157,7 @@ public class Indexer extends SpelNodeImpl {
this.map.put(this.key, newValue);
}
@Override
public boolean isWritable() {
return true;
}
@@ -176,6 +182,7 @@ public class Indexer extends SpelNodeImpl {
this.td = targetObjectTypeDescriptor;
}
@Override
public TypedValue getValue() {
Class<?> targetObjectRuntimeClass = getObjectClass(targetObject);
try {
@@ -209,6 +216,7 @@ public class Indexer extends SpelNodeImpl {
this.td.toString());
}
@Override
public void setValue(Object newValue) {
Class<?> contextObjectClass = getObjectClass(targetObject);
try {
@@ -238,6 +246,7 @@ public class Indexer extends SpelNodeImpl {
}
}
@Override
public boolean isWritable() {
return true;
}
@@ -266,6 +275,7 @@ public class Indexer extends SpelNodeImpl {
this.growCollection = growCollection;
}
@Override
public TypedValue getValue() {
if (this.index >= this.collection.size()) {
if (this.growCollection) {
@@ -290,6 +300,7 @@ public class Indexer extends SpelNodeImpl {
throw new IllegalStateException("Failed to find indexed element " + this.index + ": " + this.collection);
}
@Override
public void setValue(Object newValue) {
if (this.index >= this.collection.size()) {
if (this.growCollection) {
@@ -314,6 +325,7 @@ public class Indexer extends SpelNodeImpl {
}
}
@Override
public boolean isWritable() {
return true;
}
@@ -334,6 +346,7 @@ public class Indexer extends SpelNodeImpl {
this.td = td;
}
@Override
public TypedValue getValue() {
if (this.index >= this.target.length()) {
throw new SpelEvaluationException(getStartPosition(), SpelMessage.STRING_INDEX_OUT_OF_BOUNDS,
@@ -342,11 +355,13 @@ public class Indexer extends SpelNodeImpl {
return new TypedValue(String.valueOf(this.target.charAt(this.index)));
}
@Override
public void setValue(Object newValue) {
throw new SpelEvaluationException(getStartPosition(), SpelMessage.INDEXING_NOT_SUPPORTED_FOR_TYPE,
this.td.toString());
}
@Override
public boolean isWritable() {
return true;
}

View File

@@ -66,6 +66,7 @@ public class MethodReference extends SpelNodeImpl {
this.arguments = arguments;
}
@Override
public TypedValue getValue() {
MethodExecutor executorToUse = cachedExecutor;
if (executorToUse != null) {
@@ -103,10 +104,12 @@ public class MethodReference extends SpelNodeImpl {
}
}
@Override
public void setValue(Object newValue) {
throw new IllegalAccessError();
}
@Override
public boolean isWritable() {
return false;
}

View File

@@ -93,6 +93,7 @@ public class OpMinus extends Operator {
}
return super.toStringAST();
}
@Override
public SpelNodeImpl getRightOperand() {
if (children.length<2) {return null;}
return children[1];

View File

@@ -83,14 +83,17 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
this.isAutoGrowNullReferences = isAutoGrowNullReferences;
}
@Override
public TypedValue getValue() {
return ref.getValueInternal(contextObject,eContext,isAutoGrowNullReferences);
}
@Override
public void setValue(Object newValue) {
ref.writeProperty(contextObject,eContext, ref.name, newValue);
}
@Override
public boolean isWritable() {
return true;
}

View File

@@ -88,6 +88,7 @@ public abstract class SpelNodeImpl implements SpelNode {
return false;
}
@Override
public final Object getValue(ExpressionState expressionState) throws EvaluationException {
if (expressionState != null) {
return getValueInternal(expressionState).getValue();
@@ -97,6 +98,7 @@ public abstract class SpelNodeImpl implements SpelNode {
}
}
@Override
public final TypedValue getTypedValue(ExpressionState expressionState) throws EvaluationException {
if (expressionState != null) {
return getValueInternal(expressionState);
@@ -107,22 +109,27 @@ public abstract class SpelNodeImpl implements SpelNode {
}
// by default Ast nodes are not writable
@Override
public boolean isWritable(ExpressionState expressionState) throws EvaluationException {
return false;
}
@Override
public void setValue(ExpressionState expressionState, Object newValue) throws EvaluationException {
throw new SpelEvaluationException(getStartPosition(), SpelMessage.SETVALUE_NOT_SUPPORTED, getClass());
}
@Override
public SpelNode getChild(int index) {
return children[index];
}
@Override
public int getChildCount() {
return children.length;
}
@Override
public Class<?> getObjectClass(Object obj) {
if (obj == null) {
return null;
@@ -136,12 +143,15 @@ public abstract class SpelNodeImpl implements SpelNode {
public abstract TypedValue getValueInternal(ExpressionState expressionState) throws EvaluationException;
@Override
public abstract String toStringAST();
@Override
public int getStartPosition() {
return (pos>>16);
}
@Override
public int getEndPosition() {
return (pos&0xffff);
}

View File

@@ -40,10 +40,12 @@ public interface ValueRef {
static NullValueRef instance = new NullValueRef();
@Override
public TypedValue getValue() {
return TypedValue.NULL;
}
@Override
public void setValue(Object newValue) {
// The exception position '0' isn't right but the overhead of creating
// instances of this per node (where the node is solely for error reporting)
@@ -51,6 +53,7 @@ public interface ValueRef {
throw new SpelEvaluationException(0,SpelMessage.NOT_ASSIGNABLE,"null");
}
@Override
public boolean isWritable() {
return false;
}
@@ -70,15 +73,18 @@ public interface ValueRef {
this.node = node;
}
@Override
public TypedValue getValue() {
return typedValue;
}
@Override
public void setValue(Object newValue) {
throw new SpelEvaluationException(
node.pos, SpelMessage.NOT_ASSIGNABLE, node.toStringAST());
}
@Override
public boolean isWritable() {
return false;
}

View File

@@ -55,14 +55,17 @@ public class VariableReference extends SpelNodeImpl {
this.eContext = evaluationContext;
}
@Override
public TypedValue getValue() {
return value;
}
@Override
public void setValue(Object newValue) {
eContext.setVariable(name, newValue);
}
@Override
public boolean isWritable() {
return true;
}

View File

@@ -62,56 +62,67 @@ public class SpelExpression implements Expression {
// implementing Expression
@Override
public Object getValue() throws EvaluationException {
ExpressionState expressionState = new ExpressionState(getEvaluationContext(), configuration);
return ast.getValue(expressionState);
}
@Override
public Object getValue(Object rootObject) throws EvaluationException {
ExpressionState expressionState = new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration);
return ast.getValue(expressionState);
}
@Override
public <T> T getValue(Class<T> expectedResultType) throws EvaluationException {
ExpressionState expressionState = new ExpressionState(getEvaluationContext(), configuration);
TypedValue typedResultValue = ast.getTypedValue(expressionState);
return ExpressionUtils.convertTypedValue(expressionState.getEvaluationContext(), typedResultValue, expectedResultType);
}
@Override
public <T> T getValue(Object rootObject, Class<T> expectedResultType) throws EvaluationException {
ExpressionState expressionState = new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration);
TypedValue typedResultValue = ast.getTypedValue(expressionState);
return ExpressionUtils.convertTypedValue(expressionState.getEvaluationContext(), typedResultValue, expectedResultType);
}
@Override
public Object getValue(EvaluationContext context) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
return ast.getValue(new ExpressionState(context, configuration));
}
@Override
public Object getValue(EvaluationContext context, Object rootObject) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
return ast.getValue(new ExpressionState(context, toTypedValue(rootObject), configuration));
}
@Override
public <T> T getValue(EvaluationContext context, Class<T> expectedResultType) throws EvaluationException {
TypedValue typedResultValue = ast.getTypedValue(new ExpressionState(context, configuration));
return ExpressionUtils.convertTypedValue(context, typedResultValue, expectedResultType);
}
@Override
public <T> T getValue(EvaluationContext context, Object rootObject, Class<T> expectedResultType) throws EvaluationException {
TypedValue typedResultValue = ast.getTypedValue(new ExpressionState(context, toTypedValue(rootObject), configuration));
return ExpressionUtils.convertTypedValue(context, typedResultValue, expectedResultType);
}
@Override
public Class<?> getValueType() throws EvaluationException {
return getValueType(getEvaluationContext());
}
@Override
public Class<?> getValueType(Object rootObject) throws EvaluationException {
return getValueType(getEvaluationContext(), rootObject);
}
@Override
public Class<?> getValueType(EvaluationContext context) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
ExpressionState eState = new ExpressionState(context, configuration);
@@ -119,60 +130,72 @@ public class SpelExpression implements Expression {
return typeDescriptor != null ? typeDescriptor.getType() : null;
}
@Override
public Class<?> getValueType(EvaluationContext context, Object rootObject) throws EvaluationException {
ExpressionState eState = new ExpressionState(context, toTypedValue(rootObject), configuration);
TypeDescriptor typeDescriptor = ast.getValueInternal(eState).getTypeDescriptor();
return typeDescriptor != null ? typeDescriptor.getType() : null;
}
@Override
public TypeDescriptor getValueTypeDescriptor() throws EvaluationException {
return getValueTypeDescriptor(getEvaluationContext());
}
@Override
public TypeDescriptor getValueTypeDescriptor(Object rootObject) throws EvaluationException {
ExpressionState eState = new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration);
return ast.getValueInternal(eState).getTypeDescriptor();
}
@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
ExpressionState eState = new ExpressionState(context, configuration);
return ast.getValueInternal(eState).getTypeDescriptor();
}
@Override
public TypeDescriptor getValueTypeDescriptor(EvaluationContext context, Object rootObject) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
ExpressionState eState = new ExpressionState(context, toTypedValue(rootObject), configuration);
return ast.getValueInternal(eState).getTypeDescriptor();
}
@Override
public String getExpressionString() {
return expression;
}
@Override
public boolean isWritable(EvaluationContext context) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
return ast.isWritable(new ExpressionState(context, configuration));
}
@Override
public boolean isWritable(Object rootObject) throws EvaluationException {
return ast.isWritable(new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration));
}
@Override
public boolean isWritable(EvaluationContext context, Object rootObject) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
return ast.isWritable(new ExpressionState(context, toTypedValue(rootObject), configuration));
}
@Override
public void setValue(EvaluationContext context, Object value) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
ast.setValue(new ExpressionState(context, configuration), value);
}
@Override
public void setValue(Object rootObject, Object value) throws EvaluationException {
ast.setValue(new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration), value);
}
@Override
public void setValue(EvaluationContext context, Object rootObject, Object value) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
ast.setValue(new ExpressionState(context, toTypedValue(rootObject), configuration), value);

View File

@@ -54,6 +54,7 @@ class ReflectiveConstructorExecutor implements ConstructorExecutor {
this.argsRequiringConversion = argsRequiringConversion;
}
@Override
public TypedValue execute(EvaluationContext context, Object... arguments) throws AccessException {
try {
if (arguments != null) {

View File

@@ -49,6 +49,7 @@ public class ReflectiveConstructorResolver implements ConstructorResolver {
* registered type converter.
* </ol>
*/
@Override
public ConstructorExecutor resolve(EvaluationContext context, String typename, List<TypeDescriptor> argumentTypes)
throws AccessException {
@@ -58,6 +59,7 @@ public class ReflectiveConstructorResolver implements ConstructorResolver {
Constructor[] ctors = type.getConstructors();
Arrays.sort(ctors, new Comparator<Constructor>() {
@Override
public int compare(Constructor c1, Constructor c2) {
int c1pl = c1.getParameterTypes().length;
int c2pl = c2.getParameterTypes().length;

View File

@@ -55,6 +55,7 @@ class ReflectiveMethodExecutor implements MethodExecutor {
}
@Override
public TypedValue execute(EvaluationContext context, Object target, Object... arguments) throws AccessException {
try {
if (arguments != null) {

View File

@@ -86,6 +86,7 @@ public class ReflectiveMethodResolver implements MethodResolver {
* according to the registered type converter.
* </ol>
*/
@Override
public MethodExecutor resolve(EvaluationContext context, Object targetObject, String name,
List<TypeDescriptor> argumentTypes) throws AccessException {
@@ -111,6 +112,7 @@ public class ReflectiveMethodResolver implements MethodResolver {
}
Arrays.sort(methods, new Comparator<Method>() {
@Override
public int compare(Method m1, Method m2) {
int m1pl = m1.getParameterTypes().length;
int m2pl = m2.getParameterTypes().length;

View File

@@ -56,10 +56,12 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
/**
* @return null which means this is a general purpose accessor
*/
@Override
public Class<?>[] getSpecificTargetClasses() {
return null;
}
@Override
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
if (target == null) {
return false;
@@ -94,6 +96,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
return false;
}
@Override
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
if (target == null) {
throw new AccessException("Cannot read property of null target");
@@ -160,6 +163,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
throw new AccessException("Neither getter nor field found for property '" + name + "'");
}
@Override
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
if (target == null) {
return false;
@@ -189,6 +193,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
return false;
}
@Override
public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
if (target == null) {
throw new AccessException("Cannot write property on null target");
@@ -497,10 +502,12 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
}
}
@Override
public Class[] getSpecificTargetClasses() {
throw new UnsupportedOperationException("Should not be called on an OptimalPropertyAccessor");
}
@Override
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
if (target == null) {
return false;
@@ -524,6 +531,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
}
}
@Override
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
if (this.member instanceof Method) {
try {
@@ -552,10 +560,12 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
throw new AccessException("Neither getter nor field found for property '" + name + "'");
}
@Override
public boolean canWrite(EvaluationContext context, Object target, String name) {
throw new UnsupportedOperationException("Should not be called on an OptimalPropertyAccessor");
}
@Override
public void write(EvaluationContext context, Object target, String name, Object newValue) {
throw new UnsupportedOperationException("Should not be called on an OptimalPropertyAccessor");
}

View File

@@ -89,6 +89,7 @@ public class StandardEvaluationContext implements EvaluationContext {
this.rootObject = (rootObject != null ? new TypedValue(rootObject) : TypedValue.NULL);
}
@Override
public TypedValue getRootObject() {
return this.rootObject;
}
@@ -103,6 +104,7 @@ public class StandardEvaluationContext implements EvaluationContext {
return this.constructorResolvers.remove(resolver);
}
@Override
public List<ConstructorResolver> getConstructorResolvers() {
ensureConstructorResolversInitialized();
return this.constructorResolvers;
@@ -123,6 +125,7 @@ public class StandardEvaluationContext implements EvaluationContext {
return this.methodResolvers.remove(methodResolver);
}
@Override
public List<MethodResolver> getMethodResolvers() {
ensureMethodResolversInitialized();
return this.methodResolvers;
@@ -132,6 +135,7 @@ public class StandardEvaluationContext implements EvaluationContext {
this.beanResolver = beanResolver;
}
@Override
public BeanResolver getBeanResolver() {
return this.beanResolver;
}
@@ -150,6 +154,7 @@ public class StandardEvaluationContext implements EvaluationContext {
return this.propertyAccessors.remove(accessor);
}
@Override
public List<PropertyAccessor> getPropertyAccessors() {
ensurePropertyAccessorsInitialized();
return this.propertyAccessors;
@@ -165,6 +170,7 @@ public class StandardEvaluationContext implements EvaluationContext {
this.typeLocator = typeLocator;
}
@Override
public TypeLocator getTypeLocator() {
if (this.typeLocator == null) {
this.typeLocator = new StandardTypeLocator();
@@ -177,6 +183,7 @@ public class StandardEvaluationContext implements EvaluationContext {
this.typeConverter = typeConverter;
}
@Override
public TypeConverter getTypeConverter() {
if (this.typeConverter == null) {
this.typeConverter = new StandardTypeConverter();
@@ -189,6 +196,7 @@ public class StandardEvaluationContext implements EvaluationContext {
this.typeComparator = typeComparator;
}
@Override
public TypeComparator getTypeComparator() {
return this.typeComparator;
}
@@ -198,10 +206,12 @@ public class StandardEvaluationContext implements EvaluationContext {
this.operatorOverloader = operatorOverloader;
}
@Override
public OperatorOverloader getOperatorOverloader() {
return this.operatorOverloader;
}
@Override
public void setVariable(String name, Object value) {
this.variables.put(name, value);
}
@@ -214,6 +224,7 @@ public class StandardEvaluationContext implements EvaluationContext {
this.variables.put(name, method);
}
@Override
public Object lookupVariable(String name) {
return this.variables.get(name);
}

View File

@@ -26,11 +26,13 @@ import org.springframework.expression.OperatorOverloader;
*/
public class StandardOperatorOverloader implements OperatorOverloader {
@Override
public boolean overridesOperation(Operation operation, Object leftOperand, Object rightOperand)
throws EvaluationException {
return false;
}
@Override
public Object operate(Operation operation, Object leftOperand, Object rightOperand) throws EvaluationException {
throw new EvaluationException("No operation overloaded by default");
}

View File

@@ -29,6 +29,7 @@ import org.springframework.expression.spel.SpelMessage;
*/
public class StandardTypeComparator implements TypeComparator {
@Override
@SuppressWarnings("unchecked")
public int compare(Object left, Object right) throws SpelEvaluationException {
// If one is null, check if the other is
@@ -72,6 +73,7 @@ public class StandardTypeComparator implements TypeComparator {
throw new SpelEvaluationException(SpelMessage.NOT_COMPARABLE, left.getClass(), right.getClass());
}
@Override
public boolean canCompare(Object left, Object right) {
if (left == null || right == null) {
return true;

View File

@@ -57,10 +57,12 @@ public class StandardTypeConverter implements TypeConverter {
}
@Override
public boolean canConvert(TypeDescriptor sourceType, TypeDescriptor targetType) {
return this.conversionService.canConvert(sourceType, targetType);
}
@Override
public Object convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType) {
try {
return this.conversionService.convert(value, sourceType, targetType);

View File

@@ -59,6 +59,7 @@ public class StandardTypeLocator implements TypeLocator {
* @return the class object for the type
* @throws EvaluationException if the type cannot be found
*/
@Override
public Class<?> findType(String typename) throws EvaluationException {
String nameToLookup = typename;
try {