renamed TypeDescriptor to BindingPoint

This commit is contained in:
Keith Donald
2009-05-15 17:30:03 +00:00
parent 6f74369cb3
commit cf2453e8eb
20 changed files with 105 additions and 105 deletions

View File

@@ -23,7 +23,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.BindingPoint;
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 TypeDescriptor mapElementTypeDescriptor = TypeDescriptor.valueOf(Color.class);
private static BindingPoint mapElementTypeDescriptor = BindingPoint.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),TypeDescriptor.valueOf(Color.class));
return new TypedValue(propertyMap.get(name),BindingPoint.valueOf(Color.class));
}
public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {

View File

@@ -18,7 +18,7 @@ package org.springframework.expression.spel;
import java.util.HashMap;
import java.util.Map;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.BindingPoint;
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,TypeDescriptor.NULL_TYPE_DESCRIPTOR);
((StandardEvaluationContext)state.getEvaluationContext()).setRootObject(null,BindingPoint.NULL_TYPE_DESCRIPTOR);
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,TypeDescriptor.valueOf(String.class));
String s = (String)state.convertValue(34,BindingPoint.valueOf(String.class));
assertEquals("34",s);
s = (String)state.convertValue(new TypedValue(34),TypeDescriptor.valueOf(String.class));
s = (String)state.convertValue(new TypedValue(34),BindingPoint.valueOf(String.class));
assertEquals("34",s);
}

View File

@@ -19,25 +19,25 @@ package org.springframework.expression.spel;
import java.util.ArrayList;
import java.util.List;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.core.convert.BindingPoint;
import org.springframework.core.convert.support.DefaultTypeConverter;
import org.springframework.core.convert.support.GenericTypeConverter;
import org.springframework.expression.EvaluationException;
import org.springframework.expression.Expression;
import org.springframework.expression.TypeConverter;
import org.springframework.expression.spel.support.StandardEvaluationContext;
/**
* Expression evaluation where the TypeConverter plugged in is the {@link GenericConversionService}
* Expression evaluation where the TypeConverter plugged in is the {@link GenericTypeConverter}
*
* @author Andy Clement
*/
public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCase {
private static List<String> listOfString = new ArrayList<String>();
private static TypeDescriptor typeDescriptorForListOfString = null;
private static BindingPoint typeDescriptorForListOfString = null;
private static List<Integer> listOfInteger = new ArrayList<Integer>();
private static TypeDescriptor typeDescriptorForListOfInteger = null;
private static BindingPoint typeDescriptorForListOfInteger = null;
static {
listOfString.add("1");
@@ -50,8 +50,8 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas
public void setUp() throws Exception {
super.setUp();
typeDescriptorForListOfString = new TypeDescriptor(ExpressionTestsUsingCoreConversionService.class.getDeclaredField("listOfString"));
typeDescriptorForListOfInteger = new TypeDescriptor(ExpressionTestsUsingCoreConversionService.class.getDeclaredField("listOfInteger"));
typeDescriptorForListOfString = new BindingPoint(ExpressionTestsUsingCoreConversionService.class.getDeclaredField("listOfString"));
typeDescriptorForListOfInteger = new BindingPoint(ExpressionTestsUsingCoreConversionService.class.getDeclaredField("listOfInteger"));
}
@@ -93,23 +93,23 @@ public class ExpressionTestsUsingCoreConversionService extends ExpressionTestCas
*/
private static class TypeConvertorUsingConversionService implements TypeConverter {
private final DefaultConversionService service = new DefaultConversionService();
private final DefaultTypeConverter service = new DefaultTypeConverter();
public boolean canConvert(Class<?> sourceType, Class<?> targetType) {
return this.service.canConvert(sourceType, TypeDescriptor.valueOf(targetType));
return this.service.canConvert(sourceType, BindingPoint.valueOf(targetType));
}
public boolean canConvert(Class<?> sourceType, TypeDescriptor typeDescriptor) {
public boolean canConvert(Class<?> sourceType, BindingPoint 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,TypeDescriptor.valueOf(targetType));
return (T) this.service.convert(value,BindingPoint.valueOf(targetType));
}
@SuppressWarnings("unchecked")
public Object convertValue(Object value, TypeDescriptor typeDescriptor) throws EvaluationException {
public Object convertValue(Object value, BindingPoint typeDescriptor) throws EvaluationException {
return this.service.convert(value, typeDescriptor);
}
}

View File

@@ -19,7 +19,7 @@ package org.springframework.expression.spel;
import java.lang.reflect.Method;
import org.springframework.core.MethodParameter;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.BindingPoint;
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(),TypeDescriptor.valueOf(Principal.class));
return new TypedValue(new Principal(),BindingPoint.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,TypeDescriptor.valueOf(Person.class));
return new TypedValue(activePerson,BindingPoint.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 TypeDescriptor(new MethodParameter(m,-1)));
return new TypedValue(m.invoke(null, args), new BindingPoint(new MethodParameter(m,-1)));
}
catch (Exception ex) {
throw new AccessException("Problem invoking hasRole", ex);