Anonymous avatar Anonymous committed 643f568

XW-733 merge 'parameters-binder' branch into trunk

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@2065 e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (3)

core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java

 import com.opensymphony.xwork2.DefaultUnknownHandlerManager;
 import com.opensymphony.xwork2.TextProvider;
 import com.opensymphony.xwork2.UnknownHandlerManager;
+import com.opensymphony.xwork2.parameters.XWorkParametersBinder;
+import com.opensymphony.xwork2.parameters.bytecode.AccessorBytecodeUtil;
+import com.opensymphony.xwork2.parameters.accessor.*;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
 import com.opensymphony.xwork2.config.ConfigurationProvider;
                .factory(ActionProxyFactory.class, DefaultActionProxyFactory.class, Scope.SINGLETON)
                .factory(ObjectTypeDeterminer.class, DefaultObjectTypeDeterminer.class, Scope.SINGLETON)
                .factory(XWorkConverter.class, Scope.SINGLETON)
+               .factory(XWorkParametersBinder.class, Scope.SINGLETON)
                .factory(ValueStackFactory.class, OgnlValueStackFactory.class, Scope.SINGLETON)
                .factory(ValidatorFactory.class, DefaultValidatorFactory.class, Scope.SINGLETON)
                .factory(ValidatorFileParser.class, DefaultValidatorFileParser.class, Scope.SINGLETON)
                .factory(PropertyAccessor.class, Iterator.class.getName(), XWorkIteratorPropertyAccessor.class, Scope.SINGLETON)
                .factory(PropertyAccessor.class, Enumeration.class.getName(), XWorkEnumerationAccessor.class, Scope.SINGLETON)
                .factory(UnknownHandlerManager.class, DefaultUnknownHandlerManager.class, Scope.SINGLETON)
+
+               .factory(ParametersPropertyAccessor.class, List.class.getName(), ParametersListPropertyAccessor.class, Scope.SINGLETON)
+               .factory(ParametersPropertyAccessor.class, ArrayList.class.getName(), ParametersListPropertyAccessor.class, Scope.SINGLETON)
+               .factory(ParametersPropertyAccessor.class, HashSet.class.getName(), ParametersCollectionPropertyAccessor.class, Scope.SINGLETON)
+               .factory(ParametersPropertyAccessor.class, Set.class.getName(), ParametersCollectionPropertyAccessor.class, Scope.SINGLETON)
+               .factory(ParametersPropertyAccessor.class, HashMap.class.getName(), ParametersMapPropertyAccessor.class, Scope.SINGLETON)
+               .factory(ParametersPropertyAccessor.class, Map.class.getName(), ParametersMapPropertyAccessor.class, Scope.SINGLETON)
+               .factory(ParametersPropertyAccessor.class, CompoundRoot.class.getName(), ParametersCompoundRootAccessor.class, Scope.SINGLETON)
+               .factory(ParametersPropertyAccessor.class, Object.class.getName(), ParametersObjectPropertyAccessor.class, Scope.SINGLETON)
+               .factory(AccessorBytecodeUtil.class)
                
                // silly workarounds for ognl since there is no way to flush its caches
                .factory(PropertyAccessor.class, List.class.getName(), XWorkListPropertyAccessor.class, Scope.SINGLETON)
         props.setProperty("devMode", Boolean.FALSE.toString());
         props.setProperty("logMissingProperties", Boolean.FALSE.toString());
         props.setProperty("enableOGNLExpressionCache", Boolean.TRUE.toString());
+        props.setProperty("enableSimpleParametersBinder", Boolean.FALSE.toString());
     }
 
 }

core/src/main/java/com/opensymphony/xwork2/util/reflection/ReflectionContextState.java

 		String currentPath=getCurrentPropertyPath(context);
 		if (name!=null) {
 			if (currentPath!=null) {
-				currentPath=currentPath + "." + name.toString();
+                StringBuilder sb = new StringBuilder(currentPath);
+                sb.append(".");
+                sb.append(name.toString());
+				currentPath = sb.toString();
 			}	else {
-				currentPath=name.toString();
+				currentPath = name.toString();
 			}
 			context.put(CURRENT_PROPERTY_PATH, currentPath);
 		}

core/src/test/java/com/opensymphony/xwork2/SimpleAction.java

     private String aliasDest;
     private Map<String,String> protectedMap = new HashMap<String,String>();
     private Map<String,String> existingMap = new HashMap<String,String>();
-    
-    public static boolean resultCalled;
+    private Map<String,String> someMap;
+    private String[] stringArray = new String[5];
+    private int[] intArray = new int[5];
+    private Collection<SimpleAction> someCollection = new ArrayList<SimpleAction>();
 
+    private Map<String,TestBean> otherMap = new HashMap<String,TestBean>();
+    private List<TestBean> otherList = new ArrayList<TestBean>();
+
+    public static boolean resultCalled;
+    private SimpleAction nestedAction;
 
     public SimpleAction() {
         resultCalled = false;
         existingMap.put("existingKey", "value");
     }
-    
+
+    public List<TestBean> getOtherList() {
+        return otherList;
+    }
+
+    public void setOtherList(List<TestBean> otherList) {
+        this.otherList = otherList;
+    }
+
+    public void setOtherMap(Map<String, TestBean> otherMap) {
+        this.otherMap = otherMap;
+    }
+
+    public Map<String, TestBean> getOtherMap() {
+        return otherMap;
+    }
+
+    public Collection<SimpleAction> getSomeCollection() {
+        return someCollection;
+    }
+
+    public void setSomeCollection(Collection<SimpleAction> someCollection) {
+        this.someCollection = someCollection;
+    }
+
+    public SimpleAction getNestedAction() {
+        return nestedAction;
+    }
+
+    public void setNestedAction(SimpleAction nestedAction) {
+        this.nestedAction = nestedAction;
+    }
+
+    public String[] getStringArray() {
+        return stringArray;
+    }
+
+    public void setStringArray(String[] stringArray) {
+        this.stringArray = stringArray;
+    }
+
+    public int[] getIntArray() {
+        return intArray;
+    }
+
+    public void setIntArray(int[] intArray) {
+        this.intArray = intArray;
+    }
+
+    public Map<String, String> getSomeMap() {
+        return someMap;
+    }
+
+    public void setSomeMap(Map<String, String> someMap) {
+        this.someMap = someMap;
+    }
+
     public Map<String,String> getTheProtectedMap() {
         return protectedMap;
     }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.