costin code review comments
This commit is contained in:
@@ -23,7 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.core.convert.ConversionPoint;
|
||||
import org.springframework.core.convert.ConversionContext;
|
||||
import org.springframework.expression.AccessException;
|
||||
import org.springframework.expression.EvaluationContext;
|
||||
import org.springframework.expression.EvaluationException;
|
||||
@@ -236,7 +236,7 @@ public class ExpressionLanguageScenarioTests extends ExpressionTestCase {
|
||||
private static class FruitColourAccessor implements PropertyAccessor {
|
||||
|
||||
private static Map<String,Color> propertyMap = new HashMap<String,Color>();
|
||||
private static ConversionPoint mapElementTypeDescriptor = ConversionPoint.valueOf(Color.class);
|
||||
private static ConversionContext mapElementTypeDescriptor = ConversionContext.valueOf(Color.class);
|
||||
|
||||
static {
|
||||
propertyMap.put("banana",Color.yellow);
|
||||
@@ -295,7 +295,7 @@ public class ExpressionLanguageScenarioTests extends ExpressionTestCase {
|
||||
}
|
||||
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return new TypedValue(propertyMap.get(name),ConversionPoint.valueOf(Color.class));
|
||||
return new TypedValue(propertyMap.get(name),ConversionContext.valueOf(Color.class));
|
||||
}
|
||||
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.expression.spel;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.core.convert.ConversionPoint;
|
||||
import org.springframework.core.convert.ConversionContext;
|
||||
import org.springframework.expression.EvaluationContext;
|
||||
import org.springframework.expression.EvaluationException;
|
||||
import org.springframework.expression.Operation;
|
||||
@@ -117,7 +117,7 @@ public class ExpressionStateTests extends ExpressionTestCase {
|
||||
assertEquals(TypedValue.NULL_TYPED_VALUE,state.getRootContextObject());
|
||||
|
||||
|
||||
((StandardEvaluationContext)state.getEvaluationContext()).setRootObject(null,ConversionPoint.NULL);
|
||||
((StandardEvaluationContext)state.getEvaluationContext()).setRootObject(null,ConversionContext.NULL);
|
||||
assertEquals(null,state.getRootContextObject().getValue());
|
||||
}
|
||||
|
||||
@@ -222,10 +222,10 @@ public class ExpressionStateTests extends ExpressionTestCase {
|
||||
|
||||
public void testTypeConversion() throws EvaluationException {
|
||||
ExpressionState state = getState();
|
||||
String s = (String)state.convertValue(34,ConversionPoint.valueOf(String.class));
|
||||
String s = (String)state.convertValue(34,ConversionContext.valueOf(String.class));
|
||||
assertEquals("34",s);
|
||||
|
||||
s = (String)state.convertValue(new TypedValue(34),ConversionPoint.valueOf(String.class));
|
||||
s = (String)state.convertValue(new TypedValue(34),ConversionContext.valueOf(String.class));
|
||||
assertEquals("34",s);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.expression.spel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.core.convert.ConversionPoint;
|
||||
import org.springframework.core.convert.ConversionContext;
|
||||
import org.springframework.core.convert.support.DefaultTypeConverter;
|
||||
import org.springframework.core.convert.support.GenericTypeConverter;
|
||||
import org.springframework.expression.EvaluationException;
|
||||
@@ -35,9 +35,9 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCase {
|
||||
|
||||
private static List<String> listOfString = new ArrayList<String>();
|
||||
private static ConversionPoint typeDescriptorForListOfString = null;
|
||||
private static ConversionContext typeDescriptorForListOfString = null;
|
||||
private static List<Integer> listOfInteger = new ArrayList<Integer>();
|
||||
private static ConversionPoint typeDescriptorForListOfInteger = null;
|
||||
private static ConversionContext typeDescriptorForListOfInteger = null;
|
||||
|
||||
static {
|
||||
listOfString.add("1");
|
||||
@@ -50,8 +50,8 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
typeDescriptorForListOfString = new ConversionPoint(ExpressionTestsUsingCoreConversionService.class.getDeclaredField("listOfString"));
|
||||
typeDescriptorForListOfInteger = new ConversionPoint(ExpressionTestsUsingCoreConversionService.class.getDeclaredField("listOfInteger"));
|
||||
typeDescriptorForListOfString = new ConversionContext(ExpressionTestsUsingCoreConversionService.class.getDeclaredField("listOfString"));
|
||||
typeDescriptorForListOfInteger = new ConversionContext(ExpressionTestsUsingCoreConversionService.class.getDeclaredField("listOfInteger"));
|
||||
}
|
||||
|
||||
|
||||
@@ -96,20 +96,20 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas
|
||||
private final DefaultTypeConverter service = new DefaultTypeConverter();
|
||||
|
||||
public boolean canConvert(Class<?> sourceType, Class<?> targetType) {
|
||||
return this.service.canConvert(sourceType, ConversionPoint.valueOf(targetType));
|
||||
return this.service.canConvert(sourceType, ConversionContext.valueOf(targetType));
|
||||
}
|
||||
|
||||
public boolean canConvert(Class<?> sourceType, ConversionPoint typeDescriptor) {
|
||||
public boolean canConvert(Class<?> sourceType, ConversionContext typeDescriptor) {
|
||||
return this.service.canConvert(sourceType, typeDescriptor);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T convertValue(Object value, Class<T> targetType) throws EvaluationException {
|
||||
return (T) this.service.convert(value,ConversionPoint.valueOf(targetType));
|
||||
return (T) this.service.convert(value,ConversionContext.valueOf(targetType));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object convertValue(Object value, ConversionPoint typeDescriptor) throws EvaluationException {
|
||||
public Object convertValue(Object value, ConversionContext typeDescriptor) throws EvaluationException {
|
||||
return this.service.convert(value, typeDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.expression.spel;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.convert.ConversionPoint;
|
||||
import org.springframework.core.convert.ConversionContext;
|
||||
import org.springframework.expression.AccessException;
|
||||
import org.springframework.expression.EvaluationContext;
|
||||
import org.springframework.expression.EvaluationException;
|
||||
@@ -214,7 +214,7 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase {
|
||||
}
|
||||
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return new TypedValue(new Principal(),ConversionPoint.valueOf(Principal.class));
|
||||
return new TypedValue(new Principal(),ConversionContext.valueOf(Principal.class));
|
||||
}
|
||||
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
@@ -244,7 +244,7 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase {
|
||||
}
|
||||
|
||||
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
return new TypedValue(activePerson,ConversionPoint.valueOf(Person.class));
|
||||
return new TypedValue(activePerson,ConversionContext.valueOf(Person.class));
|
||||
}
|
||||
|
||||
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
|
||||
@@ -283,7 +283,7 @@ public class ScenariosForSpringSecurity extends ExpressionTestCase {
|
||||
if (m.isVarArgs()) {
|
||||
args = ReflectionHelper.setupArgumentsForVarargsInvocation(m.getParameterTypes(), args);
|
||||
}
|
||||
return new TypedValue(m.invoke(null, args), new ConversionPoint(new MethodParameter(m,-1)));
|
||||
return new TypedValue(m.invoke(null, args), new ConversionContext(new MethodParameter(m,-1)));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new AccessException("Problem invoking hasRole", ex);
|
||||
|
||||
Reference in New Issue
Block a user