Remove trailing whitespace in source files

find . -type f -name "*.java" -or -name "*.aj" | \
    xargs perl -p -i -e "s/[ \t]*$//g" {} \;

Issue: SPR-10127
This commit is contained in:
Phillip Webb
2012-12-18 13:45:00 -08:00
committed by Chris Beams
parent 44a474a014
commit 1762157ad1
1400 changed files with 5920 additions and 5923 deletions

View File

@@ -18,7 +18,7 @@ package org.springframework.expression;
/**
* An AccessException is thrown by an accessor if it has an unexpected problem.
*
*
* @author Andy Clement
* @since 3.0
*/

View File

@@ -35,4 +35,3 @@ public interface BeanResolver {
Object resolve(EvaluationContext context, String beanName) throws AccessException;
}

View File

@@ -23,10 +23,10 @@ package org.springframework.expression;
* back to the resolvers. For example, the particular constructor to run on a class may be discovered by the reflection
* constructor resolver - it will then build a ConstructorExecutor that executes that constructor and the
* ConstructorExecutor can be reused without needing to go back to the resolver to discover the constructor again.
*
*
* They can become stale, and in that case should throw an AccessException - this will cause the infrastructure to go
* back to the resolvers to ask for a new one.
*
*
* @author Andy Clement
* @since 3.0
*/

View File

@@ -18,7 +18,7 @@ package org.springframework.expression;
/**
* Represent an exception that occurs during expression evaluation.
*
*
* @author Andy Clement
* @since 3.0
*/
@@ -28,7 +28,7 @@ public class EvaluationException extends ExpressionException {
* Creates a new expression evaluation exception.
* @param position the position in the expression where the problem occurred
* @param message description of the problem that occurred
*/
*/
public EvaluationException(int position, String message) {
super(position, message);
}
@@ -37,7 +37,7 @@ public class EvaluationException extends ExpressionException {
* Creates a new expression evaluation exception.
* @param expressionString the expression that could not be evaluated
* @param message description of the problem that occurred
*/
*/
public EvaluationException(String expressionString, String message) {
super(expressionString, message);
}
@@ -47,7 +47,7 @@ public class EvaluationException extends ExpressionException {
* @param position the position in the expression where the problem occurred
* @param message description of the problem that occurred
* @param cause the underlying cause of this exception
*/
*/
public EvaluationException(int position, String message, Throwable cause) {
super(position, message, cause);
}
@@ -55,7 +55,7 @@ public class EvaluationException extends ExpressionException {
/**
* Creates a new expression evaluation exception.
* @param message description of the problem that occurred
*/
*/
public EvaluationException(String message) {
super(message);
}

View File

@@ -37,14 +37,14 @@ public interface Expression {
*/
Object getValue() throws EvaluationException;
/**
/**
* Evaluate this expression against the specified root object
* @param rootObject the root object against which properties/etc will be resolved
* @return the evaluation result
* @throws EvaluationException if there is a problem during evaluation
*/
Object getValue(Object rootObject) throws EvaluationException;
/**
* Evaluate the expression in the default context. If the result of the evaluation does not match (and
* cannot be converted to) the expected result type then an exception will be returned.
@@ -53,10 +53,10 @@ public interface Expression {
* @throws EvaluationException if there is a problem during evaluation
*/
<T> T getValue(Class<T> desiredResultType) throws EvaluationException;
/**
* Evaluate the expression in the default context against the specified root object. If the
* result of the evaluation does not match (and cannot be converted to) the expected result type
* Evaluate the expression in the default context against the specified root object. If the
* result of the evaluation does not match (and cannot be converted to) the expected result type
* then an exception will be returned.
* @param rootObject the root object against which properties/etc will be resolved
* @param desiredResultType the class the caller would like the result to be
@@ -82,7 +82,7 @@ public interface Expression {
* @throws EvaluationException if there is a problem during evaluation
*/
Object getValue(EvaluationContext context, Object rootObject) throws EvaluationException;
/**
* Evaluate the expression in a specified context which can resolve references to properties, methods, types, etc -
* the type of the evaluation result is expected to be of a particular class and an exception will be thrown if it
@@ -132,7 +132,7 @@ public interface Expression {
* @throws EvaluationException if there is a problem determining the type
*/
Class getValueType(EvaluationContext context) throws EvaluationException;
/**
* Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)}
* method for the given context. The supplied root object overrides any specified in the context.
@@ -150,7 +150,7 @@ public interface Expression {
* @throws EvaluationException if there is a problem determining the type
*/
TypeDescriptor getValueTypeDescriptor() throws EvaluationException;
/**
* Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)}
* method using the default context.
@@ -207,13 +207,13 @@ public interface Expression {
/**
* Set this expression in the provided context to the value provided.
*
*
* @param context the context in which to set the value of the expression
* @param value the new value
* @throws EvaluationException if there is a problem during evaluation
*/
void setValue(EvaluationContext context, Object value) throws EvaluationException;
/**
* Set this expression in the provided context to the value provided.
* @param rootObject the root object against which to evaluate the expression
@@ -231,7 +231,7 @@ public interface Expression {
* @throws EvaluationException if there is a problem during evaluation
*/
void setValue(EvaluationContext context, Object rootObject, Object value) throws EvaluationException;
/**
* Returns the original string used to create this expression, unmodified.
* @return the original expression string

View File

@@ -38,7 +38,7 @@ public class ExpressionException extends RuntimeException {
this.position = -1;
this.expressionString = expressionString;
}
/**
* Creates a new expression exception.
* @param expressionString the expression string
@@ -66,7 +66,7 @@ public class ExpressionException extends RuntimeException {
* @param position the position in the expression string where the problem occurred
* @param message a descriptive message
* @param cause the underlying cause of this exception
*/
*/
public ExpressionException(int position, String message, Throwable cause) {
super(message,cause);
this.position = position;
@@ -75,7 +75,7 @@ public class ExpressionException extends RuntimeException {
/**
* Creates a new expression exception.
* @param message a descriptive message
*/
*/
public ExpressionException(String message) {
super(message);
}
@@ -99,11 +99,11 @@ public class ExpressionException extends RuntimeException {
output.append(getMessage());
return output.toString();
}
public final String getExpressionString() {
return this.expressionString;
}
public final int getPosition() {
return position;
}

View File

@@ -20,7 +20,7 @@ package org.springframework.expression;
* It differs from a SpelEvaluationException because this indicates the occurrence of a checked exception
* that the invoked method was defined to throw. SpelEvaluationExceptions are for handling (and wrapping)
* unexpected exceptions.
*
*
* @author Andy Clement
* @since 3.0.3
*/

View File

@@ -21,26 +21,26 @@ import java.util.List;
/**
* MethodFilter instances allow SpEL users to fine tune the behaviour of the method resolution
* process. Method resolution (which translates from a method name in an expression to a real
* method to invoke) will normally retrieve candidate methods for invocation via a simple call
* to 'Class.getMethods()' and will choose the first one that is suitable for the
* input parameters. By registering a MethodFilter the user can receive a callback
* method to invoke) will normally retrieve candidate methods for invocation via a simple call
* to 'Class.getMethods()' and will choose the first one that is suitable for the
* input parameters. By registering a MethodFilter the user can receive a callback
* and change the methods that will be considered suitable.
*
*
* @author Andy Clement
* @since 3.0.1
*/
public interface MethodFilter {
/**
* Called by the method resolver to allow the SpEL user to organize the list of candidate
* methods that may be invoked. The filter can remove methods that should not be
* considered candidates and it may sort the results. The resolver will then search
* through the methods as returned from the filter when looking for a suitable
* Called by the method resolver to allow the SpEL user to organize the list of candidate
* methods that may be invoked. The filter can remove methods that should not be
* considered candidates and it may sort the results. The resolver will then search
* through the methods as returned from the filter when looking for a suitable
* candidate to invoke.
*
*
* @param methods the full list of methods the resolver was going to choose from
* @return a possible subset of input methods that may be sorted by order of relevance
*/
List<Method> filter(List<Method> methods);
}

View File

@@ -18,7 +18,7 @@ package org.springframework.expression;
/**
* Supported operations that an {@link OperatorOverloader} can implement for any pair of operands.
*
*
* @author Andy Clement
* @since 3.0
*/

View File

@@ -19,7 +19,7 @@ package org.springframework.expression;
/**
* By default the mathematical operators {@link Operation} support simple types like numbers. By providing an
* implementation of OperatorOverloader, a user of the expression language can support these operations on other types.
*
*
* @author Andy Clement
* @since 3.0
*/

View File

@@ -29,7 +29,7 @@ public class ParseException extends ExpressionException {
* @param expressionString the expression string that could not be parsed
* @param position the position in the expression string where the problem occurred
* @param message description of the problem that occurred
*/
*/
public ParseException(String expressionString, int position, String message) {
super(expressionString, position, message);
}
@@ -39,16 +39,16 @@ public class ParseException extends ExpressionException {
* @param position the position in the expression string where the problem occurred
* @param message description of the problem that occurred
* @param cause the underlying cause of this exception
*/
*/
public ParseException(int position, String message, Throwable cause) {
super(position, message, cause);
}
/**
* Creates a new expression parsing exception.
* @param position the position in the expression string where the problem occurred
* @param message description of the problem that occurred
*/
*/
public ParseException(int position, String message) {
super(position, message);
}

View File

@@ -28,13 +28,13 @@ public interface ParserContext {
/**
* Whether or not the expression being parsed is a template. A template expression consists of literal text that can
* be mixed with evaluatable blocks. Some examples:
*
*
* <pre>
* Some literal text
* Hello #{name.firstName}!
* #{3 + 4}
* </pre>
*
*
* @return true if the expression is a template, false otherwise
*/
boolean isTemplate();
@@ -54,7 +54,7 @@ public interface ParserContext {
* @return the suffix that identifies the end of an expression
*/
String getExpressionSuffix();
/**
* The default ParserContext implementation that enables template expression parsing mode.
* The expression prefix is #{ and the expression suffix is }.
@@ -73,7 +73,7 @@ public interface ParserContext {
public boolean isTemplate() {
return true;
}
};
}

View File

@@ -25,7 +25,7 @@ package org.springframework.expression;
* to determine if it can read or write them. Property resolvers are considered to be ordered and each will be called in
* turn. The only rule that affects the call order is that any naming the target class directly in
* getSpecifiedTargetClasses() will be called first, before the general resolvers.
*
*
* @author Andy Clement
* @since 3.0
*/

View File

@@ -19,7 +19,7 @@ package org.springframework.expression;
/**
* Instances of a type comparator should be able to compare pairs of objects for equality, the specification of the
* return value is the same as for {@link Comparable}.
*
*
* @author Andy Clement
* @since 3.0
*/

View File

@@ -56,12 +56,12 @@ public class TypedValue {
this.value = value;
this.typeDescriptor = typeDescriptor;
}
public Object getValue() {
return this.value;
}
public TypeDescriptor getTypeDescriptor() {
if (this.typeDescriptor == null) {
this.typeDescriptor = TypeDescriptor.forObject(this.value);
@@ -76,5 +76,5 @@ public class TypedValue {
str.append("TypedValue: '").append(this.value).append("' of [").append(getTypeDescriptor() + "]");
return str.toString();
}
}

View File

@@ -31,7 +31,7 @@ import org.springframework.expression.Expression;
* which will be represented as a CompositeStringExpression of two parts. The first part being a
* LiteralExpression representing 'Hello ' and the second part being a real expression that will
* call <code>getName()</code> when invoked.
*
*
* @author Andy Clement
* @author Juergen Hoeller
* @since 3.0
@@ -60,7 +60,7 @@ public class CompositeStringExpression implements Expression {
String value = expression.getValue(String.class);
if (value != null) {
sb.append(value);
}
}
}
return sb.toString();
}
@@ -71,7 +71,7 @@ public class CompositeStringExpression implements Expression {
String value = expression.getValue(rootObject, String.class);
if (value != null) {
sb.append(value);
}
}
}
return sb.toString();
}
@@ -93,7 +93,7 @@ public class CompositeStringExpression implements Expression {
String value = expression.getValue(context, rootObject, String.class);
if (value != null) {
sb.append(value);
}
}
}
return sb.toString();
}
@@ -131,7 +131,7 @@ public class CompositeStringExpression implements Expression {
public boolean isWritable(EvaluationContext context) {
return false;
}
public Expression[] getExpressions() {
return expressions;
}

View File

@@ -52,7 +52,7 @@ public class LiteralExpression implements Expression {
public String getValue(EvaluationContext context) {
return this.literalValue;
}
public String getValue(Object rootObject) {
return this.literalValue;
}

View File

@@ -38,7 +38,7 @@ public class TemplateParserContext implements ParserContext {
public TemplateParserContext() {
this("#{", "}");
}
/**
* Create a new TemplateParserContext for the given prefix and suffix.
* @param expressionPrefix the expression prefix to use

View File

@@ -36,22 +36,22 @@ import org.springframework.expression.TypedValue;
* expressions but it gives a place to hold local variables and for component expressions in a compound expression to
* communicate state. This is in contrast to the EvaluationContext, which is shared amongst expression evaluations, and
* any changes to it will be seen by other expressions or any code that chooses to ask questions of the context.
*
*
* <p>It also acts as a place for to define common utility routines that the various Ast nodes might need.
*
*
* @author Andy Clement
* @since 3.0
*/
public class ExpressionState {
private final EvaluationContext relatedContext;
private Stack<VariableScope> variableScopes;
private Stack<VariableScope> variableScopes;
private Stack<TypedValue> contextObjects;
private final TypedValue rootObject;
private SpelParserConfiguration configuration;
@@ -59,30 +59,30 @@ public class ExpressionState {
this.relatedContext = context;
this.rootObject = context.getRootObject();
}
public ExpressionState(EvaluationContext context, SpelParserConfiguration configuration) {
this.relatedContext = context;
this.configuration = configuration;
this.rootObject = context.getRootObject();
}
public ExpressionState(EvaluationContext context, TypedValue rootObject) {
this.relatedContext = context;
this.rootObject = rootObject;
}
public ExpressionState(EvaluationContext context, TypedValue rootObject, SpelParserConfiguration configuration) {
this.relatedContext = context;
this.configuration = configuration;
this.rootObject = rootObject;
}
private void ensureVariableScopesInitialized() {
if (this.variableScopes == null) {
this.variableScopes = new Stack<VariableScope>();
// top level empty variable scope
this.variableScopes.add(new VariableScope());
this.variableScopes.add(new VariableScope());
}
}
@@ -93,7 +93,7 @@ public class ExpressionState {
if (this.contextObjects==null || this.contextObjects.isEmpty()) {
return this.rootObject;
}
return this.contextObjects.peek();
}
@@ -140,7 +140,7 @@ public class ExpressionState {
public Object convertValue(Object value, TypeDescriptor targetTypeDescriptor) throws EvaluationException {
return this.relatedContext.getTypeConverter().convertValue(value, TypeDescriptor.forObject(value), targetTypeDescriptor);
}
public TypeConverter getTypeConverter() {
return this.relatedContext.getTypeConverter();
}
@@ -153,7 +153,7 @@ public class ExpressionState {
/*
* A new scope is entered when a function is invoked
*/
public void enterScope(Map<String, Object> argMap) {
ensureVariableScopesInitialized();
this.variableScopes.push(new VariableScope(argMap));
@@ -226,7 +226,7 @@ public class ExpressionState {
this.vars.putAll(arguments);
}
}
public VariableScope(String name, Object value) {
this.vars.put(name,value);
}

View File

@@ -21,7 +21,7 @@ import org.springframework.expression.spel.SpelParseException;
/**
* Wraps a real parse exception. This exception flows to the top parse method and then
* the wrapped exception is thrown as the real problem.
*
*
* @author Andy Clement
* @since 3.0
*/
@@ -30,9 +30,9 @@ public class InternalParseException extends RuntimeException {
public InternalParseException(SpelParseException cause) {
super(cause);
}
public SpelParseException getCause() {
return (SpelParseException) super.getCause();
}
}

View File

@@ -21,7 +21,7 @@ import org.springframework.expression.EvaluationException;
* Root exception for Spring EL related exceptions. Rather than holding a hard coded string indicating the problem, it
* records a message key and the inserts for the message. See {@link SpelMessage} for the list of all possible messages
* that can occur.
*
*
* @author Andy Clement
* @since 3.0
*/
@@ -37,7 +37,7 @@ public class SpelEvaluationException extends EvaluationException {
}
public SpelEvaluationException(int position, SpelMessage message, Object... inserts) {
super(position, message.formatMessage(position, inserts));
super(position, message.formatMessage(position, inserts));
this.message = message;
this.inserts = inserts;
}
@@ -75,7 +75,7 @@ public class SpelEvaluationException extends EvaluationException {
/**
* Set the position in the related expression which gave rise to this exception.
*
*
* @param position the position in the expression that gave rise to the exception
*/
public void setPosition(int position) {

View File

@@ -24,13 +24,13 @@ import java.text.MessageFormat;
* enabling the message text to more easily be modified and the tests to run successfully in different locales.
* <p>
* When a message is formatted, it will have this kind of form
*
*
* <pre>
* EL1004E: (pos 34): Type cannot be found 'String'
* </pre>
*
*
* </code> The prefix captures the code and the error kind, whilst the position is included if it is known.
*
*
* @author Andy Clement
* @since 3.0
*/
@@ -39,7 +39,7 @@ public enum SpelMessage {
TYPE_CONVERSION_ERROR(Kind.ERROR, 1001, "Type conversion problem, cannot convert from {0} to {1}"), //
CONSTRUCTOR_NOT_FOUND(Kind.ERROR, 1002, "Constructor call: No suitable constructor found on type {0} for arguments {1}"), //
CONSTRUCTOR_INVOCATION_PROBLEM(Kind.ERROR, 1003, "A problem occurred whilst attempting to construct an object of type ''{0}'' using arguments ''{1}''"), //
METHOD_NOT_FOUND(Kind.ERROR, 1004, "Method call: Method {0} cannot be found on {1} type"), //
METHOD_NOT_FOUND(Kind.ERROR, 1004, "Method call: Method {0} cannot be found on {1} type"), //
TYPE_NOT_FOUND(Kind.ERROR, 1005, "Type cannot be found ''{0}''"), //
FUNCTION_NOT_DEFINED(Kind.ERROR, 1006, "The function ''{0}'' could not be found"), //
PROPERTY_OR_FIELD_NOT_READABLE_ON_NULL(Kind.ERROR, 1007, "Field or property ''{0}'' cannot be found on null"), //
@@ -47,7 +47,7 @@ public enum SpelMessage {
PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL(Kind.ERROR, 1009, "Field or property ''{0}'' cannot be set on null"), //
PROPERTY_OR_FIELD_NOT_WRITABLE(Kind.ERROR, 1010, "Field or property ''{0}'' cannot be set on object of type ''{1}''"), //
METHOD_CALL_ON_NULL_OBJECT_NOT_ALLOWED(Kind.ERROR, 1011, "Method call: Attempted to call method {0} on null context object"), //
CANNOT_INDEX_INTO_NULL_VALUE(Kind.ERROR, 1012, "Cannot index into a null value"),
CANNOT_INDEX_INTO_NULL_VALUE(Kind.ERROR, 1012, "Cannot index into a null value"),
NOT_COMPARABLE(Kind.ERROR, 1013, "Cannot compare instances of {0} and {1}"), //
INCORRECT_NUMBER_OF_ARGUMENTS_TO_FUNCTION(Kind.ERROR, 1014, "Incorrect number of arguments for function, {0} supplied but function takes {1}"), //
INVALID_TYPE_FOR_SELECTION(Kind.ERROR, 1015, "Cannot perform selection on input data of type ''{0}''"), //
@@ -60,22 +60,22 @@ public enum SpelMessage {
FUNCTION_REFERENCE_CANNOT_BE_INVOKED(Kind.ERROR, 1022, "The function ''{0}'' mapped to an object of type ''{1}'' which cannot be invoked"), //
EXCEPTION_DURING_FUNCTION_CALL(Kind.ERROR, 1023, "A problem occurred whilst attempting to invoke the function ''{0}'': ''{1}''"), //
ARRAY_INDEX_OUT_OF_BOUNDS(Kind.ERROR, 1024, "The array has ''{0}'' elements, index ''{1}'' is invalid"), //
COLLECTION_INDEX_OUT_OF_BOUNDS(Kind.ERROR, 1025, "The collection has ''{0}'' elements, index ''{1}'' is invalid"), //
COLLECTION_INDEX_OUT_OF_BOUNDS(Kind.ERROR, 1025, "The collection has ''{0}'' elements, index ''{1}'' is invalid"), //
STRING_INDEX_OUT_OF_BOUNDS(Kind.ERROR, 1026, "The string has ''{0}'' characters, index ''{1}'' is invalid"), //
INDEXING_NOT_SUPPORTED_FOR_TYPE(Kind.ERROR, 1027, "Indexing into type ''{0}'' is not supported"), //
INSTANCEOF_OPERATOR_NEEDS_CLASS_OPERAND(Kind.ERROR, 1028, "The operator 'instanceof' needs the right operand to be a class, not a ''{0}''"), //
EXCEPTION_DURING_METHOD_INVOCATION(Kind.ERROR, 1029, "A problem occurred when trying to execute method ''{0}'' on object of type ''{1}'': ''{2}''"), //
EXCEPTION_DURING_METHOD_INVOCATION(Kind.ERROR, 1029, "A problem occurred when trying to execute method ''{0}'' on object of type ''{1}'': ''{2}''"), //
OPERATOR_NOT_SUPPORTED_BETWEEN_TYPES(Kind.ERROR, 1030, "The operator ''{0}'' is not supported between objects of type ''{1}'' and ''{2}''"), //
PROBLEM_LOCATING_METHOD(Kind.ERROR, 1031, "Problem locating method {0} cannot on type {1}"),
PROBLEM_LOCATING_METHOD(Kind.ERROR, 1031, "Problem locating method {0} cannot on type {1}"),
SETVALUE_NOT_SUPPORTED( Kind.ERROR, 1032, "setValue(ExpressionState, Object) not supported for ''{0}''"), //
MULTIPLE_POSSIBLE_METHODS(Kind.ERROR, 1033, "Method call of ''{0}'' is ambiguous, supported type conversions allow multiple variants to match"), //
EXCEPTION_DURING_PROPERTY_WRITE(Kind.ERROR, 1034, "A problem occurred whilst attempting to set the property ''{0}'': {1}"), //
NOT_AN_INTEGER(Kind.ERROR, 1035, "The value ''{0}'' cannot be parsed as an int"), //
NOT_A_LONG(Kind.ERROR, 1036, "The value ''{0}'' cannot be parsed as a long"), //
NOT_A_LONG(Kind.ERROR, 1036, "The value ''{0}'' cannot be parsed as a long"), //
INVALID_FIRST_OPERAND_FOR_MATCHES_OPERATOR(Kind.ERROR, 1037, "First operand to matches operator must be a string. ''{0}'' is not"), //
INVALID_SECOND_OPERAND_FOR_MATCHES_OPERATOR(Kind.ERROR, 1038, "Second operand to matches operator must be a string. ''{0}'' is not"), //
FUNCTION_MUST_BE_STATIC(Kind.ERROR, 1039, "Only static methods can be called via function references. The method ''{0}'' referred to by name ''{1}'' is not static."),//
NOT_A_REAL(Kind.ERROR, 1040, "The value ''{0}'' cannot be parsed as a double"), //
NOT_A_REAL(Kind.ERROR, 1040, "The value ''{0}'' cannot be parsed as a double"), //
MORE_INPUT(Kind.ERROR,1041, "After parsing a valid expression, there is still more data in the expression: ''{0}''"),
RIGHT_OPERAND_PROBLEM(Kind.ERROR,1042, "Problem parsing right operand"),
NOT_EXPECTED_TOKEN(Kind.ERROR,1043,"Unexpected token. Expected ''{0}'' but was ''{1}''"),
@@ -93,7 +93,7 @@ public enum SpelMessage {
UNABLE_TO_CREATE_MAP_FOR_INDEXING(Kind.ERROR,1055,"Unable to dynamically create a Map to replace a null value"),//
UNABLE_TO_DYNAMICALLY_CREATE_OBJECT(Kind.ERROR,1056,"Unable to dynamically create instance of ''{0}'' to replace a null value"),//
NO_BEAN_RESOLVER_REGISTERED(Kind.ERROR,1057,"No bean resolver registered in the context to resolve access to bean ''{0}''"),//
EXCEPTION_DURING_BEAN_RESOLUTION(Kind.ERROR, 1058, "A problem occurred when trying to resolve bean ''{0}'':''{1}''"), //
EXCEPTION_DURING_BEAN_RESOLUTION(Kind.ERROR, 1058, "A problem occurred when trying to resolve bean ''{0}'':''{1}''"), //
INVALID_BEAN_REFERENCE(Kind.ERROR,1059,"@ can only be followed by an identifier or a quoted name"),//
TYPE_NAME_EXPECTED_FOR_ARRAY_CONSTRUCTION(Kind.ERROR, 1060,
"Expected the type of the new array to be specified as a String but found ''{0}''"), //
@@ -125,7 +125,7 @@ public enum SpelMessage {
/**
* Produce a complete message including the prefix, the position (if known) and with the inserts applied to the
* message.
*
*
* @param pos the position, if less than zero it is ignored and not included in the message
* @param inserts the inserts to put into the formatted message
* @return a formatted message

View File

@@ -22,7 +22,7 @@ import org.springframework.expression.ParseException;
* Root exception for Spring EL related exceptions. Rather than holding a hard coded string indicating the problem, it
* records a message key and the inserts for the message. See {@link SpelMessage} for the list of all possible messages
* that can occur.
*
*
* @author Andy Clement
* @since 3.0
*/
@@ -41,7 +41,7 @@ public class SpelParseException extends ParseException {
super(expressionString, position, message.formatMessage(position,inserts));
this.position = position;
this.message = message;
this.inserts = inserts;
this.inserts = inserts;
}
public SpelParseException(int position, SpelMessage message, Object... inserts) {

View File

@@ -29,7 +29,7 @@ import org.springframework.expression.spel.ExpressionState;
* @since 3.0.2
*/
public class AstUtils {
/**
* Determines the set of property resolvers that should be used to try and access a property on the specified target
* type. The resolvers are considered to be in an ordered list, however in the returned list any that are exact
@@ -37,7 +37,7 @@ public class AstUtils {
* the start of the list. In addition, there are specific resolvers that exactly name the class in question and
* resolvers that name a specific class but it is a supertype of the class we have. These are put at the end of the
* specific resolvers set and will be tried after exactly matching accessors but before generic accessors.
*
*
* @param targetType the type upon which property access is being attempted
* @return a list of resolvers that should be tried in order to access the property
*/

View File

@@ -26,13 +26,13 @@ import org.springframework.expression.spel.SpelMessage;
/**
* Represents a bean reference to a type, for example "@foo" or "@'foo.bar'"
*
*
* @author Andy Clement
*/
public class BeanReference extends SpelNodeImpl {
private String beanname;
public BeanReference(int pos,String beanname) {
super(pos);
this.beanname = beanname;
@@ -64,5 +64,5 @@ public class BeanReference extends SpelNodeImpl {
}
return sb.toString();
}
}

View File

@@ -23,7 +23,7 @@ import org.springframework.expression.spel.SpelEvaluationException;
/**
* Represents a DOT separated expression sequence, such as 'property1.property2.methodOne()'
*
*
* @author Andy Clement
* @since 3.0
*/

View File

@@ -44,7 +44,7 @@ import org.springframework.expression.spel.SpelNode;
* new String('hello world')<br>
* new int[]{1,2,3,4}<br>
* new int[3] new int[3]{1,2,3}
*
*
* @author Andy Clement
* @author Juergen Hoeller
* @since 3.0
@@ -137,7 +137,7 @@ public class ConstructorReference extends SpelNodeImpl {
throw new SpelEvaluationException(getStartPosition(), rootCause,
SpelMessage.CONSTRUCTOR_INVOCATION_PROBLEM, typename, FormatHelper
.formatMethodForMessage("", argumentTypes));
}
}
}
// at this point we know it wasn't a user problem so worth a retry if a better candidate can be found

View File

@@ -22,7 +22,7 @@ import org.springframework.core.convert.TypeDescriptor;
/**
* Utility methods (formatters, etc) used during parsing and evaluation.
*
*
* @author Andy Clement
*/
public class FormatHelper {
@@ -46,7 +46,7 @@ public class FormatHelper {
sb.append(formatClassNameForMessage(typeDescriptor.getType()));
}
else {
sb.append(formatClassNameForMessage(null));
sb.append(formatClassNameForMessage(null));
}
}
sb.append(")");
@@ -60,7 +60,7 @@ public class FormatHelper {
* @return a formatted string suitable for message inclusion
*/
public static String formatClassNameForMessage(Class<?> clazz) {
if (clazz == null) {
if (clazz == null) {
return "null";
}
StringBuilder fmtd = new StringBuilder();

View File

@@ -74,7 +74,7 @@ public class FunctionReference extends SpelNodeImpl {
/**
* Execute a function represented as a java.lang.reflect.Method.
*
*
* @param state the expression evaluation state
* @param the java method to invoke
* @return the return value of the invoked Java method

View File

@@ -26,7 +26,7 @@ import org.springframework.expression.spel.SpelNode;
/**
* Represent a list in an expression, e.g. '{1,2,3}'
*
*
* @author Andy Clement
* @since 3.0.4
*/

View File

@@ -28,7 +28,7 @@ public class IntLiteral extends Literal {
private final TypedValue value;
IntLiteral(String payload, int pos, int value) {
super(payload, pos);
super(payload, pos);
this.value = new TypedValue(value);
}

View File

@@ -21,13 +21,13 @@ import org.springframework.expression.spel.*;
/**
* Common superclass for nodes representing literals (boolean, string, number, etc).
*
*
* @author Andy Clement
*/
public abstract class Literal extends SpelNodeImpl {
protected String literalValue;
public Literal(String payload, int pos) {
super(pos);
this.literalValue = payload;
@@ -53,7 +53,7 @@ public abstract class Literal extends SpelNodeImpl {
/**
* Process the string form of a number, using the specified base if supplied and return an appropriate literal to
* hold it. Any suffix to indicate a long will be taken into account (either 'l' or 'L' is supported).
*
*
* @param numberToken the token holding the number as its payload (eg. 1234 or 0xCAFE)
* @param radix the base of number
* @return a subtype of Literal that can represent it
@@ -84,7 +84,7 @@ public abstract class Literal extends SpelNodeImpl {
return new FloatLiteral(numberToken, pos, value);
} else {
double value = Double.parseDouble(numberToken);
return new RealLiteral(numberToken, pos, value);
return new RealLiteral(numberToken, pos, value);
}
} catch (NumberFormatException nfe) {
throw new InternalParseException(new SpelParseException(pos>>16, nfe, SpelMessage.NOT_A_REAL, numberToken));

View File

@@ -29,7 +29,7 @@ public class LongLiteral extends Literal {
private final TypedValue value;
LongLiteral(String payload, int pos, long value) {
super(payload, pos);
super(payload, pos);
this.value = new TypedValue(value);
}

View File

@@ -31,7 +31,7 @@ public class OpLT extends Operator {
public OpLT(int pos, SpelNodeImpl... operands) {
super("<", pos, operands);
}
@Override
public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException {
Object left = getLeftOperand().getValueInternal(state).getValue();

View File

@@ -24,7 +24,7 @@ import org.springframework.expression.spel.ExpressionState;
/**
* Implements the {@code multiply} operator.
*
* <p>Conversions and promotions are handled as defined in
* <p>Conversions and promotions are handled as defined in
* <a href="http://java.sun.com/docs/books/jls/third_edition/html/conversions.html">Section 5.6.2
* of the Java Language Specification</a>:
*

View File

@@ -27,12 +27,12 @@ package org.springframework.expression.spel.ast;
public abstract class Operator extends SpelNodeImpl {
String operatorName;
public Operator(String payload,int pos,SpelNodeImpl... operands) {
super(pos, operands);
this.operatorName = payload;
}
public SpelNodeImpl getLeftOperand() {
return children[0];
}

View File

@@ -29,7 +29,7 @@ import org.springframework.expression.spel.support.BooleanTypedValue;
* Represents the between operator. The left operand to between must be a single value and the right operand must be a
* list - this operator returns true if the left operand is between (using the registered comparator) the two elements
* in the list. The definition of between being inclusive follows the SQL BETWEEN definition.
*
*
* @author Andy Clement
* @since 3.0
*/

View File

@@ -23,7 +23,7 @@ import org.springframework.expression.spel.ExpressionState;
/**
* The power operator.
*
*
* @author Andy Clement
* @since 3.0
*/
@@ -37,7 +37,7 @@ public class OperatorPower extends Operator {
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
SpelNodeImpl leftOp = getLeftOperand();
SpelNodeImpl rightOp = getRightOperand();
Object operandOne = leftOp.getValueInternal(state).getValue();
Object operandTwo = rightOp.getValueInternal(state).getValue();
if (operandOne instanceof Number && operandTwo instanceof Number) {

View File

@@ -32,7 +32,7 @@ import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
/**
* Represents projection, where a given operation is performed on all elements in some input sequence, returning
* Represents projection, where a given operation is performed on all elements in some input sequence, returning
* a new sequence of the same size. For example:
* "{1,2,3,4,5,6,7,8,9,10}.!{#isEven(#this)}" returns "[n, y, n, y, n, y, n, y, n, y]"
*
@@ -43,7 +43,7 @@ import org.springframework.util.ObjectUtils;
public class Projection extends SpelNodeImpl {
private final boolean nullSafe;
public Projection(boolean nullSafe, int pos, SpelNodeImpl expression) {
super(pos, expression);
this.nullSafe = nullSafe;
@@ -61,7 +61,7 @@ public class Projection extends SpelNodeImpl {
Object operand = op.getValue();
boolean operandIsArray = ObjectUtils.isArray(operand);
// TypeDescriptor operandTypeDescriptor = op.getTypeDescriptor();
// When the input is a map, we push a special context object on the stack
// before calling the specified operation. This special context object
// has two fields 'key' and 'value' that refer to the map entries key

View File

@@ -34,10 +34,10 @@ import org.springframework.expression.spel.support.ReflectivePropertyAccessor;
/**
* Represents a simple property or field reference.
*
*
* @author Andy Clement
* @author Juergen Hoeller
* @author Clark Duplichien
* @author Clark Duplichien
* @since 3.0
*/
public class PropertyOrFieldReference extends SpelNodeImpl {
@@ -119,7 +119,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
if ((resultDescriptor.getType().equals(List.class) || resultDescriptor.getType().equals(Map.class))) {
// Create a new collection or map ready for the indexer
if (resultDescriptor.getType().equals(List.class)) {
try {
try {
if (isWritableProperty(this.name,contextObject,eContext)) {
List<?> newList = ArrayList.class.newInstance();
writeProperty(contextObject, eContext, this.name, newList);
@@ -136,7 +136,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
}
}
else {
try {
try {
if (isWritableProperty(this.name,contextObject,eContext)) {
Map<?,?> newMap = HashMap.class.newInstance();
writeProperty(contextObject, eContext, name, newMap);
@@ -155,7 +155,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
}
else {
// 'simple' object
try {
try {
if (isWritableProperty(this.name,contextObject,eContext)) {
Object newObject = result.getTypeDescriptor().getType().newInstance();
writeProperty(contextObject, eContext, name, newObject);
@@ -169,7 +169,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
catch (IllegalAccessException ex) {
throw new SpelEvaluationException(getStartPosition(), ex,
SpelMessage.UNABLE_TO_DYNAMICALLY_CREATE_OBJECT, result.getTypeDescriptor().getType());
}
}
}
}
return result;
@@ -249,7 +249,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
}
private void writeProperty(TypedValue contextObject, EvaluationContext eContext, String name, Object newValue) throws SpelEvaluationException {
if (contextObject.getValue() == null && nullSafe) {
return;
}
@@ -339,7 +339,7 @@ public class PropertyOrFieldReference extends SpelNodeImpl {
specificAccessors.add( resolver);
break;
}
else if (clazz.isAssignableFrom(targetType)) {
else if (clazz.isAssignableFrom(targetType)) {
generalAccessors.add(resolver);
}
}

View File

@@ -27,7 +27,7 @@ public class RealLiteral extends Literal {
private final TypedValue value;
public RealLiteral(String payload, int pos, double value) {
super(payload, pos);
super(payload, pos);
this.value = new TypedValue(value);
}

View File

@@ -54,7 +54,7 @@ public class Selection extends SpelNodeImpl {
private final boolean nullSafe;
public Selection(boolean nullSafe, int variant,int pos,SpelNodeImpl expression) {
super(pos,expression);
super(pos,expression);
this.nullSafe = nullSafe;
this.variant = variant;
}
@@ -153,7 +153,7 @@ public class Selection extends SpelNodeImpl {
}
} else {
if (operand==null) {
if (nullSafe) {
if (nullSafe) {
return ValueRef.NullValueRef.instance;
} else {
throw new SpelEvaluationException(getStartPosition(), SpelMessage.INVALID_TYPE_FOR_SELECTION,
@@ -162,7 +162,7 @@ public class Selection extends SpelNodeImpl {
} else {
throw new SpelEvaluationException(getStartPosition(), SpelMessage.INVALID_TYPE_FOR_SELECTION,
operand.getClass().getName());
}
}
}
}

View File

@@ -18,7 +18,7 @@ package org.springframework.expression.spel.ast;
/**
* Captures primitive types and their corresponding class objects, plus one special entry that represents all reference
* (non-primitive) types.
*
*
* @author Andy Clement
*/
public enum TypeCode {

View File

@@ -23,7 +23,7 @@ import org.springframework.expression.spel.SpelEvaluationException;
/**
* Represents a variable reference, eg. #someVar. Note this is different to a *local* variable like $someVar
*
*
* @author Andy Clement
* @since 3.0
*/
@@ -102,7 +102,7 @@ public class VariableReference extends SpelNodeImpl {
}
@Override
public String toStringAST() {
public String toStringAST() {
return "#" + this.name;
}

View File

@@ -34,12 +34,12 @@ import org.springframework.util.Assert;
* to be evaluated in a specified context. An expression can be evaluated
* standalone or in a specified context. During expression evaluation the context
* may be asked to resolve references to types, beans, properties, and methods.
*
*
* @author Andy Clement
* @since 3.0
*/
public class SpelExpression implements Expression {
private final String expression;
private final SpelNodeImpl ast;
@@ -61,7 +61,7 @@ public class SpelExpression implements Expression {
// implementing Expression
public Object getValue() throws EvaluationException {
ExpressionState expressionState = new ExpressionState(getEvaluationContext(), configuration);
return ast.getValue(expressionState);
@@ -88,7 +88,7 @@ public class SpelExpression implements Expression {
Assert.notNull(context, "The EvaluationContext is required");
return ast.getValue(new ExpressionState(context, configuration));
}
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));
@@ -98,7 +98,7 @@ public class SpelExpression implements Expression {
TypedValue typedResultValue = ast.getTypedValue(new ExpressionState(context, configuration));
return ExpressionUtils.convertTypedValue(context, typedResultValue, expectedResultType);
}
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);
@@ -128,56 +128,56 @@ public class SpelExpression implements Expression {
public TypeDescriptor getValueTypeDescriptor() throws EvaluationException {
return getValueTypeDescriptor(getEvaluationContext());
}
public TypeDescriptor getValueTypeDescriptor(Object rootObject) throws EvaluationException {
ExpressionState eState = new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration);
return ast.getValueInternal(eState).getTypeDescriptor();
}
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();
}
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();
}
public String getExpressionString() {
return expression;
}
public boolean isWritable(EvaluationContext context) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
Assert.notNull(context, "The EvaluationContext is required");
return ast.isWritable(new ExpressionState(context, configuration));
}
public boolean isWritable(Object rootObject) throws EvaluationException {
return ast.isWritable(new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration));
}
public boolean isWritable(EvaluationContext context, Object rootObject) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
Assert.notNull(context, "The EvaluationContext is required");
return ast.isWritable(new ExpressionState(context, toTypedValue(rootObject), configuration));
}
public void setValue(EvaluationContext context, Object value) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
Assert.notNull(context, "The EvaluationContext is required");
ast.setValue(new ExpressionState(context, configuration), value);
}
public void setValue(Object rootObject, Object value) throws EvaluationException {
ast.setValue(new ExpressionState(getEvaluationContext(), toTypedValue(rootObject), configuration), value);
}
public void setValue(EvaluationContext context, Object rootObject, Object value) throws EvaluationException {
Assert.notNull(context, "The EvaluationContext is required");
Assert.notNull(context, "The EvaluationContext is required");
ast.setValue(new ExpressionState(context, toTypedValue(rootObject), configuration), value);
}
// impl only
/**
@@ -196,7 +196,7 @@ public class SpelExpression implements Expression {
public String toStringAST() {
return ast.toStringAST();
}
/**
* Return the default evaluation context that will be used if none is supplied on an evaluation call
* @return the default evaluation context
@@ -207,7 +207,7 @@ public class SpelExpression implements Expression {
}
return defaultContext;
}
/**
* Set the evaluation context that will be used if none is specified on an evaluation call.
* @param context an evaluation context

View File

@@ -24,7 +24,7 @@ import org.springframework.util.Assert;
/**
* SpEL parser. Instances are reusable and thread-safe.
*
*
* @author Andy Clement
* @author Juergen Hoeller
* @since 3.0

View File

@@ -18,17 +18,17 @@ package org.springframework.expression.spel.standard;
/**
* Holder for a kind of token, the associated data and its position in the input data stream (start/end).
*
*
* @author Andy Clement
* @since 3.0
*/
class Token {
TokenKind kind;
String data;
int startpos; // index of first character
int endpos; // index of char after the last character
/**
* Constructor for use when there is no particular data for the token (eg. TRUE or '+')
* @param startpos the exact start
@@ -39,17 +39,17 @@ class Token {
this.startpos = startpos;
this.endpos = endpos;
}
Token(TokenKind tokenKind, char[] tokenData, int pos, int endpos) {
this(tokenKind,pos,endpos);
this.data = new String(tokenData);
}
public TokenKind getKind() {
return kind;
}
public String toString() {
StringBuilder s = new StringBuilder();
s.append("[").append(kind.toString());

View File

@@ -22,9 +22,9 @@ package org.springframework.expression.spel.standard;
*/
enum TokenKind {
// ordered by priority - operands first
LITERAL_INT, LITERAL_LONG, LITERAL_HEXINT, LITERAL_HEXLONG, LITERAL_STRING, LITERAL_REAL, LITERAL_REAL_FLOAT,
LITERAL_INT, LITERAL_LONG, LITERAL_HEXINT, LITERAL_HEXLONG, LITERAL_STRING, LITERAL_REAL, LITERAL_REAL_FLOAT,
LPAREN("("), RPAREN(")"), COMMA(","), IDENTIFIER,
COLON(":"),HASH("#"),RSQUARE("]"), LSQUARE("["),
COLON(":"),HASH("#"),RSQUARE("]"), LSQUARE("["),
LCURLY("{"),RCURLY("}"),
DOT("."), PLUS("+"), STAR("*"), MINUS("-"), SELECT_FIRST("^["), SELECT_LAST("$["), QMARK("?"), PROJECT("!["),
DIV("/"), GE(">="), GT(">"), LE("<="), LT("<"), EQ("=="), NE("!="),

View File

@@ -27,12 +27,12 @@ import org.springframework.util.Assert;
/**
* Lex some input data into a stream of tokens that can then be parsed.
*
*
* @author Andy Clement
* @since 3.0
*/
class Tokenizer {
String expressionString;
char[] toProcess;
int pos;
@@ -117,7 +117,7 @@ class Tokenizer {
if (isTwoCharToken(TokenKind.SELECT_FIRST)) {
pushPairToken(TokenKind.SELECT_FIRST);
} else {
pushCharToken(TokenKind.POWER);
pushCharToken(TokenKind.POWER);
}
break;
case '!':
@@ -145,7 +145,7 @@ class Tokenizer {
if (isTwoCharToken(TokenKind.SYMBOLIC_OR)) {
pushPairToken(TokenKind.SYMBOLIC_OR);
}
break;
break;
case '?':
if (isTwoCharToken(TokenKind.SELECT)) {
pushPairToken(TokenKind.SELECT);
@@ -154,7 +154,7 @@ class Tokenizer {
} else if (isTwoCharToken(TokenKind.SAFE_NAVI)) {
pushPairToken(TokenKind.SAFE_NAVI);
} else {
pushCharToken(TokenKind.QMARK);
pushCharToken(TokenKind.QMARK);
}
break;
case '$':
@@ -216,7 +216,7 @@ class Tokenizer {
}
}
public List<Token> getTokens() {
public List<Token> getTokens() {
return tokens;
}
@@ -266,26 +266,26 @@ class Tokenizer {
tokens.add(new Token(TokenKind.LITERAL_STRING, subarray(start,pos), start, pos));
}
// REAL_LITERAL :
// REAL_LITERAL :
// ('.' (DECIMAL_DIGIT)+ (EXPONENT_PART)? (REAL_TYPE_SUFFIX)?) |
// ((DECIMAL_DIGIT)+ '.' (DECIMAL_DIGIT)+ (EXPONENT_PART)? (REAL_TYPE_SUFFIX)?) |
// ((DECIMAL_DIGIT)+ (EXPONENT_PART) (REAL_TYPE_SUFFIX)?) |
// ((DECIMAL_DIGIT)+ (REAL_TYPE_SUFFIX));
// fragment INTEGER_TYPE_SUFFIX : ( 'L' | 'l' );
// fragment HEX_DIGIT : '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'|'A'|'B'|'C'|'D'|'E'|'F'|'a'|'b'|'c'|'d'|'e'|'f';
//
// fragment EXPONENT_PART : 'e' (SIGN)* (DECIMAL_DIGIT)+ | 'E' (SIGN)* (DECIMAL_DIGIT)+ ;
// fragment HEX_DIGIT : '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'|'A'|'B'|'C'|'D'|'E'|'F'|'a'|'b'|'c'|'d'|'e'|'f';
//
// fragment EXPONENT_PART : 'e' (SIGN)* (DECIMAL_DIGIT)+ | 'E' (SIGN)* (DECIMAL_DIGIT)+ ;
// fragment SIGN : '+' | '-' ;
// fragment REAL_TYPE_SUFFIX : 'F' | 'f' | 'D' | 'd';
// INTEGER_LITERAL
// : (DECIMAL_DIGIT)+ (INTEGER_TYPE_SUFFIX)?;
// : (DECIMAL_DIGIT)+ (INTEGER_TYPE_SUFFIX)?;
private void lexNumericLiteral(boolean firstCharIsZero) {
boolean isReal = false;
int start = pos;
char ch = toProcess[pos+1];
boolean isHex = ch=='x' || ch=='X';
// deal with hexadecimal
if (firstCharIsZero && isHex) {
pos=pos+1;
@@ -293,16 +293,16 @@ class Tokenizer {
pos++;
} while (isHexadecimalDigit(toProcess[pos]));
if (isChar('L','l')) {
pushHexIntToken(subarray(start+2,pos),true, start, pos);
pushHexIntToken(subarray(start+2,pos),true, start, pos);
pos++;
} else {
pushHexIntToken(subarray(start+2,pos),false, start, pos);
pushHexIntToken(subarray(start+2,pos),false, start, pos);
}
return;
}
// real numbers must have leading digits
// Consume first part of number
do {
pos++;
@@ -311,7 +311,7 @@ class Tokenizer {
// a '.' indicates this number is a real
ch = toProcess[pos];
if (ch=='.') {
isReal = true;
isReal = true;
int dotpos = pos;
// carry on consuming digits
do {
@@ -328,9 +328,9 @@ class Tokenizer {
}
int endOfNumber = pos;
// Now there may or may not be an exponent
// is it a long ?
if (isChar('L','l')) {
if (isReal) { // 3.4L - not allowed
@@ -345,7 +345,7 @@ class Tokenizer {
if (isSign(possibleSign)) {
pos++;
}
// exponent digits
do {
pos++;
@@ -354,7 +354,7 @@ class Tokenizer {
if (isFloatSuffix(toProcess[pos])) {
isFloat = true;
endOfNumber = ++pos;
} else if (isDoubleSuffix(toProcess[pos])) {
} else if (isDoubleSuffix(toProcess[pos])) {
endOfNumber = ++pos;
}
pushRealToken(subarray(start,pos), isFloat, start, pos);
@@ -367,7 +367,7 @@ class Tokenizer {
endOfNumber = ++pos;
} else if (isDoubleSuffix(ch)) {
isReal = true;
endOfNumber = ++pos;
endOfNumber = ++pos;
}
if (isReal) {
pushRealToken(subarray(start,endOfNumber), isFloat, start, endOfNumber);
@@ -386,7 +386,7 @@ class Tokenizer {
pos++;
} while (isIdentifier(toProcess[pos]));
char[] subarray = subarray(start,pos);
// Check if this is the alternative (textual) representation of an operator (see alternativeOperatorNames)
if ((pos-start)==2 || (pos-start)==3) {
String asString = new String(subarray).toUpperCase();
@@ -409,7 +409,7 @@ class Tokenizer {
private void pushHexIntToken(char[] data,boolean isLong, int start, int end) {
if (data.length==0) {
if (isLong) {
if (isLong) {
throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NOT_A_LONG,expressionString.substring(start,end+1)));
} else {
throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NOT_AN_INTEGER,expressionString.substring(start,end)));
@@ -426,7 +426,7 @@ class Tokenizer {
if (isFloat) {
tokens.add(new Token(TokenKind.LITERAL_REAL_FLOAT, data, start, end));
} else {
tokens.add(new Token(TokenKind.LITERAL_REAL, data, start, end));
tokens.add(new Token(TokenKind.LITERAL_REAL, data, start, end));
}
}
@@ -512,7 +512,7 @@ class Tokenizer {
return (flags[ch] & IS_HEXDIGIT)!=0;
}
private static final byte flags[] = new byte[256];
private static final byte flags[] = new byte[256];
private static final byte IS_DIGIT=0x01;
private static final byte IS_HEXDIGIT=0x02;
private static final byte IS_ALPHA=0x04;

View File

@@ -32,7 +32,7 @@ public class BooleanTypedValue extends TypedValue {
private BooleanTypedValue(boolean b) {
super(b);
}
public static BooleanTypedValue forValue(boolean b) {
if (b) {

View File

@@ -72,7 +72,7 @@ public class ReflectionHelper {
if (suppliedArg.isAssignableTo(expectedArg)) {
if (match != ArgsMatchKind.REQUIRES_CONVERSION) {
match = ArgsMatchKind.CLOSE;
}
}
}
else if (typeConverter.canConvert(suppliedArg, expectedArg)) {
if (argsRequiringConversion == null) {
@@ -103,7 +103,7 @@ public class ReflectionHelper {
}
}
}
/**
* Based on {@link MethodInvoker#getTypeDifferenceWeight(Class[], Object[])} but operates on TypeDescriptors.
*/
@@ -153,17 +153,17 @@ public class ReflectionHelper {
* type by the converter. This variant of compareArguments also allows for a varargs match.
* @param expectedArgTypes the array of types the method/constructor is expecting
* @param suppliedArgTypes the array of types that are being supplied at the point of invocation
* @param typeConverter a registered type converter
* @param typeConverter a registered type converter
* @return a MatchInfo object indicating what kind of match it was or null if it was not a match
*/
static ArgumentsMatchInfo compareArgumentsVarargs(
List<TypeDescriptor> expectedArgTypes, List<TypeDescriptor> suppliedArgTypes, TypeConverter typeConverter) {
Assert.isTrue(expectedArgTypes != null && expectedArgTypes.size() > 0,
"Expected arguments must at least include one array (the vargargs parameter)");
Assert.isTrue(expectedArgTypes.get(expectedArgTypes.size() - 1).isArray(),
"Final expected argument should be array type (the varargs parameter)");
ArgsMatchKind match = ArgsMatchKind.EXACT;
List<Integer> argsRequiringConversion = null;
@@ -221,7 +221,7 @@ public class ReflectionHelper {
if (suppliedArg == null) {
if (varargsParameterType.isPrimitive()) {
match = null;
}
}
} else {
if (varargsParameterType != suppliedArg.getType()) {
if (ClassUtils.isAssignable(varargsParameterType, suppliedArg.getType())) {
@@ -284,18 +284,18 @@ public class ReflectionHelper {
for (int i = 0; i < varargsPosition; i++) {
TypeDescriptor targetType = new TypeDescriptor(MethodParameter.forMethodOrConstructor(methodOrCtor, i));
Object argument = arguments[i];
arguments[i] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType);
arguments[i] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType);
}
MethodParameter methodParam = MethodParameter.forMethodOrConstructor(methodOrCtor, varargsPosition);
if (varargsPosition == arguments.length - 1) {
TypeDescriptor targetType = new TypeDescriptor(methodParam);
TypeDescriptor targetType = new TypeDescriptor(methodParam);
Object argument = arguments[varargsPosition];
arguments[varargsPosition] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType);
arguments[varargsPosition] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType);
} else {
TypeDescriptor targetType = TypeDescriptor.nested(methodParam, 1);
for (int i = varargsPosition; i < arguments.length; i++) {
Object argument = arguments[i];
arguments[i] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType);
arguments[i] = converter.convertValue(argument, TypeDescriptor.forObject(argument), targetType);
}
}
}
@@ -371,7 +371,7 @@ public class ReflectionHelper {
if (argumentCount >= parameterCount) {
arraySize = argumentCount - (parameterCount - 1);
}
// Create an array for the varargs arguments
Object[] newArgs = new Object[parameterCount];
for (int i = 0; i < newArgs.length - 1; i++) {
@@ -446,9 +446,9 @@ public class ReflectionHelper {
public static enum ArgsMatchKind {
// An exact match is where the parameter types exactly match what the method/constructor being invoked is expecting
EXACT,
EXACT,
// A close match is where the parameter types either exactly match or are assignment compatible with the method/constructor being invoked
CLOSE,
CLOSE,
// A conversion match is where the type converter must be used to transform some of the parameter types
REQUIRES_CONVERSION
}
@@ -474,11 +474,11 @@ public class ReflectionHelper {
ArgumentsMatchInfo(ArgsMatchKind kind) {
this.kind = kind;
}
public boolean isExactMatch() {
return (this.kind == ArgsMatchKind.EXACT);
}
public boolean isCloseMatch() {
return (this.kind == ArgsMatchKind.CLOSE);
}
@@ -486,7 +486,7 @@ public class ReflectionHelper {
public boolean isMatchRequiringConversion() {
return (this.kind == ArgsMatchKind.REQUIRES_CONVERSION);
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("ArgumentMatch: ").append(this.kind);

View File

@@ -33,7 +33,7 @@ import org.springframework.expression.TypeConverter;
/**
* A constructor resolver that uses reflection to locate the constructor that should be invoked
*
*
* @author Andy Clement
* @author Juergen Hoeller
* @since 3.0

View File

@@ -47,13 +47,13 @@ import org.springframework.util.Assert;
* @since 3.0
*/
public class StandardEvaluationContext implements EvaluationContext {
private TypedValue rootObject;
private List<ConstructorResolver> constructorResolvers;
private List<MethodResolver> methodResolvers;
private ReflectiveMethodResolver reflectiveMethodResolver;
private List<PropertyAccessor> propertyAccessors;
@@ -67,14 +67,14 @@ public class StandardEvaluationContext implements EvaluationContext {
private OperatorOverloader operatorOverloader = new StandardOperatorOverloader();
private final Map<String, Object> variables = new HashMap<String, Object>();
private BeanResolver beanResolver;
public StandardEvaluationContext() {
setRootObject(null);
}
public StandardEvaluationContext(Object rootObject) {
this();
setRootObject(rootObject);
@@ -102,12 +102,12 @@ public class StandardEvaluationContext implements EvaluationContext {
ensureConstructorResolversInitialized();
return this.constructorResolvers.remove(resolver);
}
public List<ConstructorResolver> getConstructorResolvers() {
ensureConstructorResolversInitialized();
return this.constructorResolvers;
}
public void setConstructorResolvers(List<ConstructorResolver> constructorResolvers) {
this.constructorResolvers = constructorResolvers;
}
@@ -117,7 +117,7 @@ public class StandardEvaluationContext implements EvaluationContext {
ensureMethodResolversInitialized();
this.methodResolvers.add(this.methodResolvers.size() - 1, resolver);
}
public boolean removeMethodResolver(MethodResolver methodResolver) {
ensureMethodResolversInitialized();
return this.methodResolvers.remove(methodResolver);
@@ -131,21 +131,21 @@ public class StandardEvaluationContext implements EvaluationContext {
public void setBeanResolver(BeanResolver beanResolver) {
this.beanResolver = beanResolver;
}
public BeanResolver getBeanResolver() {
return this.beanResolver;
}
public void setMethodResolvers(List<MethodResolver> methodResolvers) {
this.methodResolvers = methodResolvers;
}
public void addPropertyAccessor(PropertyAccessor accessor) {
ensurePropertyAccessorsInitialized();
this.propertyAccessors.add(this.propertyAccessors.size() - 1, accessor);
}
public boolean removePropertyAccessor(PropertyAccessor accessor) {
return this.propertyAccessors.remove(accessor);
}
@@ -154,7 +154,7 @@ public class StandardEvaluationContext implements EvaluationContext {
ensurePropertyAccessorsInitialized();
return this.propertyAccessors;
}
public void setPropertyAccessors(List<PropertyAccessor> propertyAccessors) {
this.propertyAccessors = propertyAccessors;
}

View File

@@ -22,7 +22,7 @@ import org.springframework.expression.spel.SpelMessage;
/**
* A simple basic TypeComparator implementation. It supports comparison of numbers and types implementing Comparable.
*
*
* @author Andy Clement
* @author Juergen Hoeller
* @since 3.0
@@ -68,7 +68,7 @@ public class StandardTypeComparator implements TypeComparator {
} catch (ClassCastException cce) {
throw new SpelEvaluationException(cce, SpelMessage.NOT_COMPARABLE, left.getClass(), right.getClass());
}
throw new SpelEvaluationException(SpelMessage.NOT_COMPARABLE, left.getClass(), right.getClass());
}

View File

@@ -29,7 +29,7 @@ import org.springframework.util.Assert;
/**
* Default implementation of the {@link TypeConverter} interface,
* delegating to a core Spring {@link ConversionService}.
*
*
* @author Juergen Hoeller
* @author Andy Clement
* @since 3.0
@@ -38,7 +38,7 @@ import org.springframework.util.Assert;
public class StandardTypeConverter implements TypeConverter {
private static ConversionService defaultConversionService;
private final ConversionService conversionService;

View File

@@ -29,7 +29,7 @@ import org.springframework.util.ClassUtils;
/**
* A default implementation of a TypeLocator that uses the context classloader (or any classloader set upon it). It
* supports 'well known' packages so if a type cannot be found it will try the registered imports to locate it.
*
*
* @author Andy Clement
* @author Juergen Hoeller
* @since 3.0
@@ -95,9 +95,9 @@ public class StandardTypeLocator implements TypeLocator {
public List<String> getImportPrefixes() {
return Collections.unmodifiableList(this.knownPackagePrefixes);
}
public void removeImport(String prefix) {
this.knownPackagePrefixes.remove(prefix);
this.knownPackagePrefixes.remove(prefix);
}
}