diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/EvaluationContext.java b/org.springframework.expression/src/main/java/org/springframework/expression/EvaluationContext.java
index 33ac50df67d..a9e4745e398 100644
--- a/org.springframework.expression/src/main/java/org/springframework/expression/EvaluationContext.java
+++ b/org.springframework.expression/src/main/java/org/springframework/expression/EvaluationContext.java
@@ -51,16 +51,6 @@ public interface EvaluationContext {
*/
Object lookupVariable(String name);
- // TODO lookupReference() - is it too expensive to return all objects within a context?
- /**
- * Look up an object reference in a particular context. If no contextName is specified (null), assume the default
- * context. If no objectName is specified (null), return all objects in the specified context (List).
- * @param contextName the context in which to perform the lookup (or null for default context)
- * @param objectName the object to lookup in the context (or null to get all objects)
- * @return a specific object or List
- */
- Object lookupReference(Object contextName, String objectName) throws EvaluationException;
-
/**
* @return a list of resolvers that will be asked in turn to locate a constructor
*/
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 b0bace6209b..f3546dfbd61 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
@@ -91,10 +91,6 @@ public class ExpressionState {
return this.relatedContext.lookupVariable(name);
}
- public Object lookupReference(Object contextName, String objectName) throws EvaluationException {
- return this.relatedContext.lookupReference(contextName, objectName);
- }
-
public TypeComparator getTypeComparator() {
return this.relatedContext.getTypeComparator();
}
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 92ad0cc9109..21d3269302d 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
@@ -47,8 +47,6 @@ public class StandardEvaluationContext implements EvaluationContext {
private final Map variables = new HashMap();
- private final Map> simpleReferencesMap = new HashMap>();
-
private final List constructorResolvers = new ArrayList();
private final List methodResolvers = new ArrayList();
@@ -63,14 +61,12 @@ public class StandardEvaluationContext implements EvaluationContext {
private OperatorOverloader operatorOverloader = new StandardOperatorOverloader();
-
public StandardEvaluationContext() {
this.methodResolvers.add(new ReflectiveMethodResolver());
this.constructorResolvers.add(new ReflectiveConstructorResolver());
this.propertyAccessors.add(new ReflectivePropertyResolver());
}
-
public void setRootObject(Object rootObject) {
this.rootObject = rootObject;
}
@@ -91,28 +87,6 @@ public class StandardEvaluationContext implements EvaluationContext {
return this.variables.get(name);
}
- public void addReference(String contextName, String objectName, Object value) {
- Map contextMap = this.simpleReferencesMap.get(contextName);
- if (contextMap == null) {
- contextMap = new HashMap();
- this.simpleReferencesMap.put(contextName, contextMap);
- }
- contextMap.put(objectName, value);
- }
-
- public Object lookupReference(Object contextName, String objectName) {
- String contextToLookup = (contextName == null ? "root" : (String) contextName);
- // if (contextName==null) return simpleReferencesMap;
- Map contextMap = this.simpleReferencesMap.get(contextToLookup);
- if (contextMap == null) {
- return null;
- }
- if (objectName == null) {
- return contextMap;
- }
- return contextMap.get(objectName);
- }
-
public void addConstructorResolver(ConstructorResolver resolver) {
this.constructorResolvers.add(this.constructorResolvers.size() - 1, resolver);
}
diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/TestScenarioCreator.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/TestScenarioCreator.java
index 7ff89ade63d..54de50d2431 100644
--- a/org.springframework.expression/src/test/java/org/springframework/expression/spel/TestScenarioCreator.java
+++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/TestScenarioCreator.java
@@ -16,16 +16,10 @@
package org.springframework.expression.spel;
-import java.awt.*;
import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
import org.springframework.expression.spel.support.StandardEvaluationContext;
-import org.springframework.expression.spel.testresources.Fruit;
import org.springframework.expression.spel.testresources.Inventor;
-import org.springframework.expression.spel.testresources.Person;
import org.springframework.expression.spel.testresources.PlaceOfBirth;
/**
@@ -39,7 +33,6 @@ public class TestScenarioCreator {
public static StandardEvaluationContext getTestEvaluationContext() {
StandardEvaluationContext testContext = new StandardEvaluationContext();
setupRootContextObject(testContext);
- populateContextMap(testContext);
populateVariables(testContext);
populateFunctions(testContext);
return testContext;
@@ -94,78 +87,6 @@ public class TestScenarioCreator {
testContext.setRootObject(tesla);
}
- /**
- * Create a context configuration that tests can reference into using the
- * @() language construct. at(context:objectName) will index a particular object within a particular context. The
- * 'root' context will be used for references where no context is specified, eg.
- * @(orange).
- *
- * @param testContext the evaluation context in which to register the new references
- */
- private static void populateContextMap(StandardEvaluationContext testContext) {
- Map> contextToReferencesMap = new HashMap>();
-
- Person andy, christian, julie, stefanie, rob, rod, adrian;
- andy = new Person("Andy");
- christian = new Person("Christian");
- julie = new Person("Julie");
- stefanie = new Person("Stefanie");
- rod = new Person("Rod");
- rob = new Person("Rob");
- adrian = new Person("Adrian");
-
- Map people = new HashMap();
- people.put("Andy", andy);
- people.put("Christian", christian);
- people.put("Julie", julie);
- people.put("Stefanie", stefanie);
-
- Map colors = new HashMap();
- colors.put("red", Color.red);
- colors.put("orange", Color.orange);
- colors.put("yellow", Color.yellow);
- colors.put("green", Color.red);
- colors.put("blue", Color.orange);
- contextToReferencesMap.put("colors", colors);
-
- Map fruits = new HashMap();
- fruits.put("orange", new Fruit("Orange", Color.orange, "orange"));
- fruits.put("apple", new Fruit("Apple", Color.green, "green"));
- fruits.put("banana", new Fruit("Banana", Color.yellow, "yellow"));
-
- Map root = new HashMap();
- root.put("orange", new Fruit("Orange", Color.orange, "orange"));
- root.put("apple", new Fruit("Apple", Color.green, "green"));
- root.put("banana", new Fruit("Banana", Color.yellow, "yellow"));
- root.put("red", Color.red);
- root.put("orange", Color.orange);
- root.put("yellow", Color.yellow);
- root.put("green", Color.red);
- root.put("blue", Color.orange);
- root.put("Andy", andy);
- root.put("Christian", christian);
- root.put("Julie", julie);
- root.put("Stefanie", stefanie);
- root.put("Adrian", adrian);
- root.put("Rob", rob);
- root.put("Rod", rod);
-
- contextToReferencesMap.put("people", people);
- contextToReferencesMap.put("fruits", fruits);
- contextToReferencesMap.put("root", root); // used if no context
- // specified
-
- contextToReferencesMap.put("a.b.c", fruits);
- java.util.Set contextKeys = contextToReferencesMap.keySet();
- for (String contextName : contextKeys) {
- Map elements = contextToReferencesMap.get(contextName);
- Set objectNames = elements.keySet();
- for (String objectName : objectNames) {
- testContext.addReference(contextName, objectName, elements.get(objectName));
- }
- }
- }
-
// These methods are registered in the test context and therefore accessible through function calls
// in test expressions