diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/Expression.java b/org.springframework.expression/src/main/java/org/springframework/expression/Expression.java index 3212ca9fe12..e0cddfa68a6 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/Expression.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/Expression.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,11 @@ package org.springframework.expression; import org.springframework.core.convert.TypeDescriptor; /** - * An expression capable of evaluating itself against context objects. Encapsulates the details of a previously parsed - * expression string. Provides a common abstraction for expression evaluation independent of any language like OGNL or - * the Unified EL. - * + * An expression capable of evaluating itself against context objects. + * Encapsulates the details of a previously parsed expression string. + * Provides a common abstraction for expression evaluation independent + * of any language like OGNL or the Unified EL. + * * @author Keith Donald * @author Andy Clement * @since 3.0 @@ -31,7 +32,6 @@ public interface Expression { /** * Evaluate this expression in the default standard context. - * * @return the evaluation result * @throws EvaluationException if there is a problem during evaluation */ @@ -39,7 +39,6 @@ public interface Expression { /** * 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 @@ -49,7 +48,6 @@ public interface Expression { /** * 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. - * * @param desiredResultType the class the caller would like the result to be * @return the evaluation result * @throws EvaluationException if there is a problem during evaluation @@ -60,7 +58,6 @@ public interface Expression { * 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 * @return the evaluation result @@ -70,7 +67,6 @@ public interface Expression { /** * Evaluate this expression in the provided context and return the result of evaluation. - * * @param context the context in which to evaluate the expression * @return the evaluation result * @throws EvaluationException if there is a problem during evaluation @@ -80,7 +76,6 @@ public interface Expression { /** * Evaluate this expression in the provided context and return the result of evaluation, but use * the supplied root context as an override for any default root object specified in the context. - * * @param context the context in which to evaluate the expression * @param rootObject the root object against which properties/etc will be resolved * @return the evaluation result @@ -92,7 +87,6 @@ public interface Expression { * 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 * is not and cannot be converted to that type. - * * @param context the context in which to evaluate the expression * @param desiredResultType the class the caller would like the result to be * @return the evaluation result @@ -105,7 +99,6 @@ public interface Expression { * the type of the evaluation result is expected to be of a particular class and an exception will be thrown if it * is not and cannot be converted to that type. The supplied root object overrides any default specified on the * supplied context. - * * @param context the context in which to evaluate the expression * @param rootObject the root object against which properties/etc will be resolved * @param desiredResultType the class the caller would like the result to be @@ -115,9 +108,8 @@ public interface Expression { T getValue(EvaluationContext context, Object rootObject, Class desiredResultType) throws EvaluationException; /** - * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} method using - * the default context. - * + * Returns the most general type that can be passed to the {@link #setValue(EvaluationContext, Object)} + * method using the default context. * @return the most general type of value that can be set on this context * @throws EvaluationException if there is a problem determining the type */ diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/common/ExpressionUtils.java b/org.springframework.expression/src/main/java/org/springframework/expression/common/ExpressionUtils.java index a1cbfccb41a..0a591c6388d 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/common/ExpressionUtils.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/common/ExpressionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,8 +42,7 @@ public abstract class ExpressionUtils { * @throws EvaluationException if there is a problem during conversion or conversion of the value to the specified * type is not supported */ - public static T convert(EvaluationContext context, Object value, Class targetType) - throws EvaluationException { + public static T convert(EvaluationContext context, Object value, Class targetType) throws EvaluationException { // TODO remove this function over time and use the one it delegates to return convertTypedValue(context,new TypedValue(value,TypeDescriptor.forObject(value)),targetType); } @@ -61,7 +60,6 @@ public abstract class ExpressionUtils { @SuppressWarnings("unchecked") public static T convertTypedValue(EvaluationContext context, TypedValue typedValue, Class targetType) { Object value = typedValue.getValue(); - if (targetType == null || ClassUtils.isAssignableValue(targetType, value)) { return (T) value; }