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

This commit is contained in:
Keith Donald
2009-12-15 19:41:52 +00:00
parent f37d7082a2
commit 2fef141a00
31 changed files with 120 additions and 138 deletions

View File

@@ -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);
}

View File

@@ -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 {

View File

@@ -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)

View File

@@ -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 {