TypeDescriptor.valueOf usage in favor of constants; TypedValue usage simplification
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user