TypeDescriptor.valueOf usage in favor of constants; TypedValue usage simplification

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2681 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Keith Donald
2009-12-15 19:41:52 +00:00
parent f0f8f56a1e
commit b34a2ab777
31 changed files with 120 additions and 138 deletions
@@ -257,10 +257,10 @@ public class ExpressionStateTests extends ExpressionTestCase {
@Test
public void testTypeConversion() throws EvaluationException {
ExpressionState state = getState();
String s = (String)state.convertValue(34,TypeDescriptor.STRING);
String s = (String)state.convertValue(34, TypeDescriptor.valueOf(String.class));
Assert.assertEquals("34",s);
s = (String)state.convertValue(new TypedValue(34),TypeDescriptor.STRING);
s = (String)state.convertValue(new TypedValue(34), TypeDescriptor.valueOf(String.class));
Assert.assertEquals("34",s);
}
@@ -29,7 +29,6 @@ import org.springframework.expression.PropertyAccessor;
import org.springframework.expression.TypedValue;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.core.convert.TypeDescriptor;
/**
* Testing variations on map access.
@@ -78,7 +77,7 @@ public class MapAccessTests extends ExpressionTestCase {
}
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
return new TypedValue(((Map) target).get(name), TypeDescriptor.OBJECT);
return new TypedValue(((Map) target).get(name));
}
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
@@ -17,8 +17,8 @@
package org.springframework.expression.spel;
import junit.framework.Assert;
import org.junit.Test;
import org.junit.Test;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.expression.AccessException;
import org.springframework.expression.EvaluationContext;
@@ -26,8 +26,8 @@ import org.springframework.expression.EvaluationException;
import org.springframework.expression.Expression;
import org.springframework.expression.PropertyAccessor;
import org.springframework.expression.TypedValue;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.standard.SpelExpression;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
///CLOVER:OFF
@@ -155,7 +155,7 @@ public class PropertyAccessTests extends ExpressionTestCase {
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
if (!name.equals("flibbles"))
throw new RuntimeException("Assertion Failed! name should be flibbles");
return new TypedValue(flibbles, TypeDescriptor.STRING);
return new TypedValue(flibbles, TypeDescriptor.valueOf(String.class));
}
public void write(EvaluationContext context, Object target, String name, Object newValue)
@@ -21,9 +21,8 @@ import java.util.Map;
import java.util.Properties;
import junit.framework.Assert;
import org.junit.Test;
import org.springframework.core.convert.TypeDescriptor;
import org.junit.Test;
import org.springframework.expression.AccessException;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.EvaluationException;
@@ -219,7 +218,7 @@ public class SpringEL300Tests extends ExpressionTestCase {
}
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
return new TypedValue(((Map) target).get(name), TypeDescriptor.OBJECT);
return new TypedValue(((Map) target).get(name));
}
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {