From a2f085d87cd287b25f60a704f81d78a0105759de Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Fri, 15 May 2009 17:30:03 +0000 Subject: [PATCH] renamed TypeDescriptor to BindingPoint git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1190 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../BeanExpressionContextAccessor.java | 2 +- .../expression/BeanFactoryAccessor.java | 2 +- .../expression/TypeConverter.java | 6 ++--- .../expression/TypedValue.java | 12 ++++----- .../expression/spel/ExpressionState.java | 10 +++---- .../spel/ast/CommonTypeDescriptors.java | 24 ++++++++--------- .../spel/ast/FunctionReference.java | 4 +-- .../expression/spel/ast/Indexer.java | 22 ++++++++-------- .../expression/spel/ast/OperatorDivide.java | 4 +-- .../expression/spel/ast/Projection.java | 8 +++--- .../expression/spel/ast/Selection.java | 14 +++++----- .../ReflectiveConstructorExecutor.java | 4 +-- .../support/ReflectiveMethodExecutor.java | 4 +-- .../support/ReflectivePropertyResolver.java | 26 +++++++++---------- .../support/StandardEvaluationContext.java | 6 ++--- .../spel/support/StandardTypeConverter.java | 14 +++++----- .../spel/ExpressionLanguageScenarioTests.java | 6 ++--- .../expression/spel/ExpressionStateTests.java | 8 +++--- ...essionTestsUsingCoreConversionService.java | 26 +++++++++---------- .../spel/ScenariosForSpringSecurity.java | 8 +++--- 20 files changed, 105 insertions(+), 105 deletions(-) diff --git a/org.springframework.context/src/main/java/org/springframework/context/expression/BeanExpressionContextAccessor.java b/org.springframework.context/src/main/java/org/springframework/context/expression/BeanExpressionContextAccessor.java index 888e0abaec9..5e6d853b318 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/expression/BeanExpressionContextAccessor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/expression/BeanExpressionContextAccessor.java @@ -17,7 +17,7 @@ package org.springframework.context.expression; import org.springframework.beans.factory.config.BeanExpressionContext; -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.PropertyAccessor; diff --git a/org.springframework.context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java b/org.springframework.context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java index 3ebe485dd74..b670472b381 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java @@ -17,7 +17,7 @@ package org.springframework.context.expression; import org.springframework.beans.factory.BeanFactory; -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.PropertyAccessor; diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/TypeConverter.java b/org.springframework.expression/src/main/java/org/springframework/expression/TypeConverter.java index e4422dd29db..8dcf1e1c9f9 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/TypeConverter.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/TypeConverter.java @@ -16,7 +16,7 @@ package org.springframework.expression; -import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.BindingPoint; /** * A type converter can convert values between different types encountered @@ -48,7 +48,7 @@ public interface TypeConverter { * @return the converted value * @throws EvaluationException if conversion is not possible */ - Object convertValue(Object value, TypeDescriptor typeDescriptor) throws EvaluationException; + Object convertValue(Object value, BindingPoint typeDescriptor) throws EvaluationException; /** * Return true if the type converter can convert the specified type to the desired target type. @@ -64,6 +64,6 @@ public interface TypeConverter { * @param typeDescriptor a type descriptor that supplies extra information about the requested result type * @return true if that conversion can be performed */ - boolean canConvert(Class sourceType, TypeDescriptor typeDescriptor); + boolean canConvert(Class sourceType, BindingPoint typeDescriptor); } diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/TypedValue.java b/org.springframework.expression/src/main/java/org/springframework/expression/TypedValue.java index 383c8064587..8bb79bb61eb 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/TypedValue.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/TypedValue.java @@ -15,7 +15,7 @@ */ package org.springframework.expression; -import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.BindingPoint; /** * Encapsulates an object and a type descriptor that describes it. @@ -28,9 +28,9 @@ import org.springframework.core.convert.TypeDescriptor; public class TypedValue { private Object value; - private TypeDescriptor typeDescriptor; + private BindingPoint typeDescriptor; - public static final TypedValue NULL_TYPED_VALUE = new TypedValue(null, TypeDescriptor.NULL_TYPE_DESCRIPTOR); + public static final TypedValue NULL_TYPED_VALUE = new TypedValue(null, BindingPoint.NULL_TYPE_DESCRIPTOR); /** * Create a TypedValue for a simple object. The type descriptor is inferred @@ -39,7 +39,7 @@ public class TypedValue { */ public TypedValue(Object value) { this.value = value; - this.typeDescriptor = TypeDescriptor.forObject(value); + this.typeDescriptor = BindingPoint.forObject(value); } /** @@ -47,7 +47,7 @@ public class TypedValue { * @param value the object value * @param typeDescriptor a type descriptor describing the type of the value */ - public TypedValue(Object value, TypeDescriptor typeDescriptor) { + public TypedValue(Object value, BindingPoint typeDescriptor) { this.value = value; this.typeDescriptor = typeDescriptor; } @@ -56,7 +56,7 @@ public class TypedValue { return this.value; } - public TypeDescriptor getTypeDescriptor() { + public BindingPoint getTypeDescriptor() { return this.typeDescriptor; } diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ExpressionState.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ExpressionState.java index 515b0c00561..a4fa52f8a80 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ExpressionState.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ExpressionState.java @@ -20,7 +20,7 @@ import java.util.List; import java.util.Map; import java.util.Stack; -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; @@ -99,7 +99,7 @@ public class ExpressionState { if (value==null) { return TypedValue.NULL_TYPED_VALUE; } else { - return new TypedValue(value,TypeDescriptor.forObject(value)); + return new TypedValue(value,BindingPoint.forObject(value)); } } @@ -111,11 +111,11 @@ public class ExpressionState { return this.relatedContext.getTypeLocator().findType(type); } - public Object convertValue(Object value, TypeDescriptor targetTypeDescriptor) throws EvaluationException { + public Object convertValue(Object value, BindingPoint targetTypeDescriptor) throws EvaluationException { return this.relatedContext.getTypeConverter().convertValue(value, targetTypeDescriptor); } - public Object convertValue(TypedValue value, TypeDescriptor targetTypeDescriptor) throws EvaluationException { + public Object convertValue(TypedValue value, BindingPoint targetTypeDescriptor) throws EvaluationException { return this.relatedContext.getTypeConverter().convertValue(value.getValue(), targetTypeDescriptor); } @@ -153,7 +153,7 @@ public class ExpressionState { OperatorOverloader overloader = this.relatedContext.getOperatorOverloader(); if (overloader.overridesOperation(op, left, right)) { Object returnValue = overloader.operate(op, left, right); - return new TypedValue(returnValue,TypeDescriptor.forObject(returnValue)); + return new TypedValue(returnValue,BindingPoint.forObject(returnValue)); } else { String leftType = (left==null?"null":left.getClass().getName()); diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/CommonTypeDescriptors.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/CommonTypeDescriptors.java index 4505025473b..f5c53ed15f4 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/CommonTypeDescriptors.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/CommonTypeDescriptors.java @@ -15,7 +15,7 @@ */ package org.springframework.expression.spel.ast; -import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.BindingPoint; /** * @author Andy Clement @@ -23,16 +23,16 @@ import org.springframework.core.convert.TypeDescriptor; */ public interface CommonTypeDescriptors { // TODO push into TypeDescriptor? - static TypeDescriptor BOOLEAN_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Boolean.class); - static TypeDescriptor INTEGER_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Integer.class); - static TypeDescriptor CHARACTER_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Character.class); - static TypeDescriptor LONG_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Long.class); - static TypeDescriptor SHORT_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Short.class); - static TypeDescriptor BYTE_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Byte.class); - static TypeDescriptor FLOAT_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Float.class); - static TypeDescriptor DOUBLE_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Double.class); - static TypeDescriptor STRING_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(String.class); - static TypeDescriptor CLASS_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Class.class); - static TypeDescriptor OBJECT_TYPE_DESCRIPTOR = TypeDescriptor.valueOf(Object.class); + static BindingPoint BOOLEAN_TYPE_DESCRIPTOR = BindingPoint.valueOf(Boolean.class); + static BindingPoint INTEGER_TYPE_DESCRIPTOR = BindingPoint.valueOf(Integer.class); + static BindingPoint CHARACTER_TYPE_DESCRIPTOR = BindingPoint.valueOf(Character.class); + static BindingPoint LONG_TYPE_DESCRIPTOR = BindingPoint.valueOf(Long.class); + static BindingPoint SHORT_TYPE_DESCRIPTOR = BindingPoint.valueOf(Short.class); + static BindingPoint BYTE_TYPE_DESCRIPTOR = BindingPoint.valueOf(Byte.class); + static BindingPoint FLOAT_TYPE_DESCRIPTOR = BindingPoint.valueOf(Float.class); + static BindingPoint DOUBLE_TYPE_DESCRIPTOR = BindingPoint.valueOf(Double.class); + static BindingPoint STRING_TYPE_DESCRIPTOR = BindingPoint.valueOf(String.class); + static BindingPoint CLASS_TYPE_DESCRIPTOR = BindingPoint.valueOf(Class.class); + static BindingPoint OBJECT_TYPE_DESCRIPTOR = BindingPoint.valueOf(Object.class); } diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/FunctionReference.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/FunctionReference.java index 9721153c8db..21d89381c42 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/FunctionReference.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/FunctionReference.java @@ -22,7 +22,7 @@ import java.lang.reflect.Modifier; import org.antlr.runtime.Token; import org.springframework.core.MethodParameter; -import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.BindingPoint; import org.springframework.expression.EvaluationException; import org.springframework.expression.TypeConverter; import org.springframework.expression.TypedValue; @@ -104,7 +104,7 @@ public class FunctionReference extends SpelNodeImpl { try { ReflectionUtils.makeAccessible(m); Object result = m.invoke(m.getClass(), functionArgs); - return new TypedValue(result, new TypeDescriptor(new MethodParameter(m,-1))); + return new TypedValue(result, new BindingPoint(new MethodParameter(m,-1))); } catch (IllegalArgumentException e) { throw new SpelException(getCharPositionInLine(), e, SpelMessages.EXCEPTION_DURING_FUNCTION_CALL, name, e .getMessage()); diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java index 76e329555c2..0fc67c75dcf 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Indexer.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Map; import org.antlr.runtime.Token; -import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.BindingPoint; import org.springframework.expression.EvaluationException; import org.springframework.expression.TypedValue; import org.springframework.expression.spel.ExpressionState; @@ -47,15 +47,15 @@ public class Indexer extends SpelNodeImpl { public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue context = state.getActiveContextObject(); Object targetObject = context.getValue(); - TypeDescriptor targetObjectTypeDescriptor = context.getTypeDescriptor(); + BindingPoint targetObjectTypeDescriptor = context.getTypeDescriptor(); TypedValue indexValue = getChild(0).getValueInternal(state); Object index = indexValue.getValue(); // Indexing into a Map if (targetObject instanceof Map) { - Object possiblyConvertedKey = state.convertValue(indexValue,TypeDescriptor.valueOf(targetObjectTypeDescriptor.getMapKeyType())); + Object possiblyConvertedKey = state.convertValue(indexValue,BindingPoint.valueOf(targetObjectTypeDescriptor.getMapKeyType())); Object o = ((Map) targetObject).get(possiblyConvertedKey); - return new TypedValue(o,TypeDescriptor.valueOf(targetObjectTypeDescriptor.getMapValueType())); + return new TypedValue(o,BindingPoint.valueOf(targetObjectTypeDescriptor.getMapValueType())); } int idx = (Integer)state.convertValue(index, INTEGER_TYPE_DESCRIPTOR); @@ -65,7 +65,7 @@ public class Indexer extends SpelNodeImpl { } if (targetObject.getClass().isArray()) { - return new TypedValue(accessArrayElement(targetObject, idx),TypeDescriptor.valueOf(targetObjectTypeDescriptor.getElementType())); + return new TypedValue(accessArrayElement(targetObject, idx),BindingPoint.valueOf(targetObjectTypeDescriptor.getElementType())); } else if (targetObject instanceof Collection) { Collection c = (Collection) targetObject; if (idx >= c.size()) { @@ -74,7 +74,7 @@ public class Indexer extends SpelNodeImpl { int pos = 0; for (Object o : c) { if (pos == idx) { - return new TypedValue(o,TypeDescriptor.valueOf(targetObjectTypeDescriptor.getElementType())); + return new TypedValue(o,BindingPoint.valueOf(targetObjectTypeDescriptor.getElementType())); } pos++; } @@ -99,7 +99,7 @@ public class Indexer extends SpelNodeImpl { public void setValue(ExpressionState state, Object newValue) throws EvaluationException { TypedValue contextObject = state.getActiveContextObject(); Object targetObject = contextObject.getValue(); - TypeDescriptor targetObjectTypeDescriptor = contextObject.getTypeDescriptor(); + BindingPoint targetObjectTypeDescriptor = contextObject.getTypeDescriptor(); TypedValue index = getChild(0).getValueInternal(state); if (targetObject == null) { @@ -108,8 +108,8 @@ public class Indexer extends SpelNodeImpl { // Indexing into a Map if (targetObjectTypeDescriptor.isMap()) { Map map = (Map)targetObject; - Object possiblyConvertedKey = state.convertValue(index.getValue(),TypeDescriptor.valueOf(targetObjectTypeDescriptor.getMapKeyType())); - Object possiblyConvertedValue = state.convertValue(newValue,TypeDescriptor.valueOf(targetObjectTypeDescriptor.getMapValueType())); + Object possiblyConvertedKey = state.convertValue(index.getValue(),BindingPoint.valueOf(targetObjectTypeDescriptor.getMapKeyType())); + Object possiblyConvertedValue = state.convertValue(newValue,BindingPoint.valueOf(targetObjectTypeDescriptor.getMapValueType())); map.put(possiblyConvertedKey,possiblyConvertedValue); return; } @@ -125,7 +125,7 @@ public class Indexer extends SpelNodeImpl { } if (targetObject instanceof List) { List list = (List)targetObject; - Object possiblyConvertedValue = state.convertValue(newValue,TypeDescriptor.valueOf(targetObjectTypeDescriptor.getElementType())); + Object possiblyConvertedValue = state.convertValue(newValue,BindingPoint.valueOf(targetObjectTypeDescriptor.getElementType())); list.set(idx,possiblyConvertedValue); } else { throw new SpelException(SpelMessages.INDEXING_NOT_SUPPORTED_FOR_TYPE, contextObject.getClass().getName()); @@ -185,7 +185,7 @@ public class Indexer extends SpelNodeImpl { } else { Object[] array = (Object[]) ctx; checkAccess(array.length, idx); - array[idx] = state.convertValue(newValue, TypeDescriptor.valueOf(clazz)); + array[idx] = state.convertValue(newValue, BindingPoint.valueOf(clazz)); } } diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/OperatorDivide.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/OperatorDivide.java index 4521d331d9c..2557de3b6ef 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/OperatorDivide.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/OperatorDivide.java @@ -17,7 +17,7 @@ package org.springframework.expression.spel.ast; import org.antlr.runtime.Token; -import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.BindingPoint; import org.springframework.expression.EvaluationException; import org.springframework.expression.Operation; import org.springframework.expression.TypedValue; @@ -56,7 +56,7 @@ public class OperatorDivide extends Operator { } } Object result = state.operate(Operation.DIVIDE, operandOne, operandTwo); - return new TypedValue(result,TypeDescriptor.forObject(result)); + return new TypedValue(result,BindingPoint.forObject(result)); } } diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Projection.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Projection.java index 1e22430aa5d..ed2ecbdcb03 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Projection.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Projection.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Map; import org.antlr.runtime.Token; -import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.BindingPoint; import org.springframework.expression.EvaluationException; import org.springframework.expression.TypedValue; import org.springframework.expression.spel.ExpressionState; @@ -60,13 +60,13 @@ public class Projection extends SpelNodeImpl { List result = new ArrayList(); for (Map.Entry entry : mapdata.entrySet()) { try { - state.pushActiveContextObject(new TypedValue(entry,TypeDescriptor.valueOf(Map.Entry.class))); + state.pushActiveContextObject(new TypedValue(entry,BindingPoint.valueOf(Map.Entry.class))); result.add(getChild(0).getValueInternal(state).getValue()); } finally { state.popActiveContextObject(); } } - return new TypedValue(result,TypeDescriptor.valueOf(List.class)); // TODO unable to build correct type descriptor + return new TypedValue(result,BindingPoint.valueOf(List.class)); // TODO unable to build correct type descriptor } else if (operand instanceof List) { List data = new ArrayList(); data.addAll((Collection) operand); @@ -74,7 +74,7 @@ public class Projection extends SpelNodeImpl { int idx = 0; for (Object element : data) { try { - state.pushActiveContextObject(new TypedValue(element,TypeDescriptor.valueOf(op.getTypeDescriptor().getType()))); + state.pushActiveContextObject(new TypedValue(element,BindingPoint.valueOf(op.getTypeDescriptor().getType()))); state.enterScope("index", idx); result.add(getChild(0).getValueInternal(state).getValue()); } finally { diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Selection.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Selection.java index 63dc213c879..96adaf44937 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Selection.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/Selection.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Map; import org.antlr.runtime.Token; -import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.BindingPoint; import org.springframework.expression.EvaluationException; import org.springframework.expression.TypedValue; import org.springframework.expression.spel.ExpressionState; @@ -66,7 +66,7 @@ public class Selection extends SpelNodeImpl { for (Map.Entry entry : mapdata.entrySet()) { try { lastKey = entry.getKey(); - TypedValue kvpair = new TypedValue(entry,TypeDescriptor.valueOf(Map.Entry.class)); + TypedValue kvpair = new TypedValue(entry,BindingPoint.valueOf(Map.Entry.class)); state.pushActiveContextObject(kvpair); Object o = selectionCriteria.getValueInternal(state).getValue(); if (o instanceof Boolean) { @@ -86,13 +86,13 @@ public class Selection extends SpelNodeImpl { } } if ((variant == FIRST || variant == LAST) && result.size() == 0) { - return new TypedValue(null,TypeDescriptor.NULL_TYPE_DESCRIPTOR); + return new TypedValue(null,BindingPoint.NULL_TYPE_DESCRIPTOR); } if (variant == LAST) { Map resultMap = new HashMap(); Object lastValue = result.get(lastKey); resultMap.put(lastKey,lastValue); - return new TypedValue(resultMap,TypeDescriptor.valueOf(Map.class)); + return new TypedValue(resultMap,BindingPoint.valueOf(Map.class)); } return new TypedValue(result,op.getTypeDescriptor()); } else if (operand instanceof Collection) { @@ -102,13 +102,13 @@ public class Selection extends SpelNodeImpl { int idx = 0; for (Object element : data) { try { - state.pushActiveContextObject(new TypedValue(element,TypeDescriptor.valueOf(op.getTypeDescriptor().getElementType()))); + state.pushActiveContextObject(new TypedValue(element,BindingPoint.valueOf(op.getTypeDescriptor().getElementType()))); state.enterScope("index", idx); Object o = selectionCriteria.getValueInternal(state).getValue(); if (o instanceof Boolean) { if (((Boolean) o).booleanValue() == true) { if (variant == FIRST) { - return new TypedValue(element,TypeDescriptor.valueOf(op.getTypeDescriptor().getElementType())); + return new TypedValue(element,BindingPoint.valueOf(op.getTypeDescriptor().getElementType())); } result.add(element); } @@ -126,7 +126,7 @@ public class Selection extends SpelNodeImpl { return TypedValue.NULL_TYPED_VALUE; } if (variant == LAST) { - return new TypedValue(result.get(result.size() - 1),TypeDescriptor.valueOf(op.getTypeDescriptor().getElementType())); + return new TypedValue(result.get(result.size() - 1),BindingPoint.valueOf(op.getTypeDescriptor().getElementType())); } return new TypedValue(result,op.getTypeDescriptor()); } else { diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorExecutor.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorExecutor.java index fa2a4478d23..32143c2fa59 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorExecutor.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorExecutor.java @@ -18,7 +18,7 @@ package org.springframework.expression.spel.support; import java.lang.reflect.Constructor; -import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.BindingPoint; import org.springframework.expression.AccessException; import org.springframework.expression.ConstructorExecutor; import org.springframework.expression.EvaluationContext; @@ -56,7 +56,7 @@ class ReflectiveConstructorExecutor implements ConstructorExecutor { if (!c.isAccessible()) { c.setAccessible(true); } - return new TypedValue(c.newInstance(arguments),TypeDescriptor.valueOf(c.getClass())); + return new TypedValue(c.newInstance(arguments),BindingPoint.valueOf(c.getClass())); } catch (Exception ex) { throw new AccessException("Problem invoking constructor: " + c, ex); } diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodExecutor.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodExecutor.java index 4cdf47346aa..a510cf33ecf 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodExecutor.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodExecutor.java @@ -19,7 +19,7 @@ package org.springframework.expression.spel.support; 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.MethodExecutor; @@ -55,7 +55,7 @@ class ReflectiveMethodExecutor implements MethodExecutor { arguments = ReflectionHelper.setupArgumentsForVarargsInvocation(this.method.getParameterTypes(), arguments); } ReflectionUtils.makeAccessible(this.method); - return new TypedValue(this.method.invoke(target, arguments), new TypeDescriptor(new MethodParameter(method,-1))); + return new TypedValue(this.method.invoke(target, arguments), new BindingPoint(new MethodParameter(method,-1))); } catch (Exception ex) { throw new AccessException("Problem invoking method: " + this.method, ex); } diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyResolver.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyResolver.java index b318d3fc34f..a22a6839bf2 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyResolver.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyResolver.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; 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; @@ -48,7 +48,7 @@ public class ReflectivePropertyResolver implements PropertyAccessor { protected final Map writerCache = new ConcurrentHashMap(); - protected final Map typeDescriptorCache = new ConcurrentHashMap(); + protected final Map typeDescriptorCache = new ConcurrentHashMap(); /** * @return null which means this is a general purpose accessor @@ -72,14 +72,14 @@ public class ReflectivePropertyResolver implements PropertyAccessor { Method method = findGetterForProperty(name, type, target instanceof Class); if (method != null) { this.readerCache.put(cacheKey, method); - this.typeDescriptorCache.put(cacheKey, new TypeDescriptor(new MethodParameter(method,-1))); + this.typeDescriptorCache.put(cacheKey, new BindingPoint(new MethodParameter(method,-1))); return true; } else { Field field = findField(name, type, target instanceof Class); if (field != null) { this.readerCache.put(cacheKey, field); - this.typeDescriptorCache.put(cacheKey, new TypeDescriptor(field)); + this.typeDescriptorCache.put(cacheKey, new BindingPoint(field)); return true; } } @@ -96,7 +96,7 @@ public class ReflectivePropertyResolver implements PropertyAccessor { if (target instanceof Class) { throw new AccessException("Cannot access length on array class itself"); } - return new TypedValue(Array.getLength(target),TypeDescriptor.valueOf(Integer.TYPE)); + return new TypedValue(Array.getLength(target),BindingPoint.valueOf(Integer.TYPE)); } CacheKey cacheKey = new CacheKey(type, name); @@ -114,7 +114,7 @@ public class ReflectivePropertyResolver implements PropertyAccessor { if (method != null) { try { ReflectionUtils.makeAccessible(method); - TypeDescriptor resultTypeDescriptor = new TypeDescriptor(new MethodParameter(method,-1)); + BindingPoint resultTypeDescriptor = new BindingPoint(new MethodParameter(method,-1)); return new TypedValue(method.invoke(target),resultTypeDescriptor); } catch (Exception ex) { @@ -135,7 +135,7 @@ public class ReflectivePropertyResolver implements PropertyAccessor { if (field != null) { try { ReflectionUtils.makeAccessible(field); - return new TypedValue(field.get(target),new TypeDescriptor(field)); + return new TypedValue(field.get(target),new BindingPoint(field)); } catch (Exception ex) { throw new AccessException("Unable to access field: " + name, ex); @@ -158,14 +158,14 @@ public class ReflectivePropertyResolver implements PropertyAccessor { Method method = findSetterForProperty(name, type, target instanceof Class); if (method != null) { this.writerCache.put(cacheKey, method); - this.typeDescriptorCache.put(cacheKey, new TypeDescriptor(new MethodParameter(method,0))); + this.typeDescriptorCache.put(cacheKey, new BindingPoint(new MethodParameter(method,0))); return true; } else { Field field = findField(name, type, target instanceof Class); if (field != null) { this.writerCache.put(cacheKey, field); - this.typeDescriptorCache.put(cacheKey, new TypeDescriptor(field)); + this.typeDescriptorCache.put(cacheKey, new BindingPoint(field)); return true; } } @@ -179,7 +179,7 @@ public class ReflectivePropertyResolver implements PropertyAccessor { Class type = (target instanceof Class ? (Class) target : target.getClass()); Object possiblyConvertedNewValue = newValue; - TypeDescriptor typeDescriptor = getTypeDescriptor(context, target, name); + BindingPoint typeDescriptor = getTypeDescriptor(context, target, name); if (typeDescriptor != null) { try { possiblyConvertedNewValue = context.getTypeConverter().convertValue(newValue, typeDescriptor); @@ -236,17 +236,17 @@ public class ReflectivePropertyResolver implements PropertyAccessor { throw new AccessException("Neither setter nor field found for property '" + name + "'"); } - private TypeDescriptor getTypeDescriptor(EvaluationContext context, Object target, String name) { + private BindingPoint getTypeDescriptor(EvaluationContext context, Object target, String name) { if (target == null) { return null; } Class type = (target instanceof Class ? (Class) target : target.getClass()); if (type.isArray() && name.equals("length")) { - return TypeDescriptor.valueOf(Integer.TYPE); + return BindingPoint.valueOf(Integer.TYPE); } CacheKey cacheKey = new CacheKey(type, name); - TypeDescriptor typeDescriptor = this.typeDescriptorCache.get(cacheKey); + BindingPoint typeDescriptor = this.typeDescriptorCache.get(cacheKey); if (typeDescriptor == null) { // attempt to populate the cache entry try { diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java index b02029cbf04..3074d303e2a 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/StandardEvaluationContext.java @@ -22,7 +22,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.ConstructorResolver; import org.springframework.expression.EvaluationContext; import org.springframework.expression.MethodResolver; @@ -75,10 +75,10 @@ public class StandardEvaluationContext implements EvaluationContext { } public void setRootObject(Object rootObject) { - this.rootObject = new TypedValue(rootObject,TypeDescriptor.forObject(rootObject)); + this.rootObject = new TypedValue(rootObject,BindingPoint.forObject(rootObject)); } - public void setRootObject(Object rootObject, TypeDescriptor typeDescriptor) { + public void setRootObject(Object rootObject, BindingPoint typeDescriptor) { this.rootObject = new TypedValue(rootObject,typeDescriptor); } diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/StandardTypeConverter.java b/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/StandardTypeConverter.java index 369615a8805..7f3a14a2e8e 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/StandardTypeConverter.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/spel/support/StandardTypeConverter.java @@ -18,8 +18,8 @@ package org.springframework.expression.spel.support; import org.springframework.core.convert.ConvertException; import org.springframework.core.convert.ConverterNotFoundException; -import org.springframework.core.convert.TypeDescriptor; -import org.springframework.core.convert.support.DefaultConversionService; +import org.springframework.core.convert.BindingPoint; +import org.springframework.core.convert.support.DefaultTypeConverter; import org.springframework.expression.EvaluationException; import org.springframework.expression.TypeConverter; import org.springframework.expression.spel.SpelException; @@ -36,7 +36,7 @@ public class StandardTypeConverter implements TypeConverter { private org.springframework.core.convert.TypeConverter typeConverter; public StandardTypeConverter() { - this.typeConverter = new DefaultConversionService(); + this.typeConverter = new DefaultTypeConverter(); } public StandardTypeConverter(org.springframework.core.convert.TypeConverter typeConverter) { @@ -46,11 +46,11 @@ public class StandardTypeConverter implements TypeConverter { @SuppressWarnings("unchecked") public T convertValue(Object value, Class targetType) throws EvaluationException { - return (T) convertValue(value, TypeDescriptor.valueOf(targetType)); + return (T) convertValue(value, BindingPoint.valueOf(targetType)); } @SuppressWarnings("unchecked") - public Object convertValue(Object value, TypeDescriptor typeDescriptor) throws EvaluationException { + public Object convertValue(Object value, BindingPoint typeDescriptor) throws EvaluationException { try { return this.typeConverter.convert(value, typeDescriptor); } @@ -63,10 +63,10 @@ public class StandardTypeConverter implements TypeConverter { } public boolean canConvert(Class sourceType, Class targetType) { - return canConvert(sourceType, TypeDescriptor.valueOf(targetType)); + return canConvert(sourceType, BindingPoint.valueOf(targetType)); } - public boolean canConvert(Class sourceType, TypeDescriptor targetType) { + public boolean canConvert(Class sourceType, BindingPoint targetType) { return this.typeConverter.canConvert(sourceType, targetType); } diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java index ab6ce9f4815..b8e45677752 100644 --- a/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java +++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionLanguageScenarioTests.java @@ -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 propertyMap = new HashMap(); - 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 { diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java index 90ccf781059..e2e5731f8a3 100644 --- a/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java +++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionStateTests.java @@ -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); } diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java index 1d66d5c0777..2e42177b1d9 100644 --- a/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java +++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/ExpressionTestsUsingCoreConversionService.java @@ -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 listOfString = new ArrayList(); - private static TypeDescriptor typeDescriptorForListOfString = null; + private static BindingPoint typeDescriptorForListOfString = null; private static List listOfInteger = new ArrayList(); - 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 convertValue(Object value, Class 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); } } diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java index f6ef4865f1a..104b06031c9 100644 --- a/org.springframework.expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java +++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/ScenariosForSpringSecurity.java @@ -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);