struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1066692 - /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/
Date Wed, 02 Feb 2011 23:27:33 GMT
Author: jafl
Date: Wed Feb  2 23:27:33 2011
New Revision: 1066692

URL: http://svn.apache.org/viewvc?rev=1066692&view=rev
Log:
XW-387 enable derived classes of config and derived classes of config bulders

Modified:
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ExceptionMappingConfig.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/InterceptorConfig.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/InterceptorStackConfig.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ResultConfig.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ResultTypeConfig.java

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java?rev=1066692&r1=1066691&r2=1066692&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java
Wed Feb  2 23:27:33 2011
@@ -214,7 +214,7 @@ public class ActionConfig extends Locate
      */
     public static class Builder implements InterceptorListHolder{
 
-        private ActionConfig target;
+        protected ActionConfig target;
 
         public Builder(ActionConfig toClone) {
             target = new ActionConfig(toClone);
@@ -240,12 +240,12 @@ public class ActionConfig extends Locate
         }
 
         public Builder defaultClassName(String name) {
-        	if (StringUtils.isEmpty(target.className)) {
-        	  	target.className = name;
-        	}
+            if (StringUtils.isEmpty(target.className)) {
+                target.className = name;
+            }
             return this;
         }
-        
+
         public Builder methodName(String method) {
             target.methodName = method;
             return this;
@@ -326,14 +326,18 @@ public class ActionConfig extends Locate
         }
 
         public ActionConfig build() {
+            embalmTarget();
+            ActionConfig result = target;
+            target = new ActionConfig(target);
+            return result;
+        }
+
+        protected void embalmTarget() {
             target.params = Collections.unmodifiableMap(target.params);
             target.results = Collections.unmodifiableMap(target.results);
             target.interceptors = Collections.unmodifiableList(target.interceptors);
             target.exceptionMappings = Collections.unmodifiableList(target.exceptionMappings);
             target.allowedMethods = Collections.unmodifiableSet(target.allowedMethods);
-            ActionConfig result = target;
-            target = new ActionConfig(target);
-            return result;
         }
     }
 }

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ExceptionMappingConfig.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ExceptionMappingConfig.java?rev=1066692&r1=1066691&r2=1066692&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ExceptionMappingConfig.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ExceptionMappingConfig.java
Wed Feb  2 23:27:33 2011
@@ -32,11 +32,10 @@ import java.util.Map;
  */
 public class ExceptionMappingConfig extends Located implements Serializable {
 
-    private String name;
-    private String exceptionClassName;
-    private String result;
-    private Map<String,String> params;
-
+    protected String name;
+    protected String exceptionClassName;
+    protected String result;
+    protected Map<String,String> params;
 
     protected ExceptionMappingConfig(String name, String exceptionClassName, String result)
{
         this.name = name;
@@ -68,7 +67,6 @@ public class ExceptionMappingConfig exte
         return params;
     }
 
-
     @Override
     public boolean equals(Object o) {
         if (this == o) {
@@ -121,7 +119,7 @@ public class ExceptionMappingConfig exte
      */
     public static class Builder{
 
-        private ExceptionMappingConfig target;
+        protected ExceptionMappingConfig target;
 
         public Builder(ExceptionMappingConfig toClone) {
             target = new ExceptionMappingConfig(toClone);
@@ -162,11 +160,15 @@ public class ExceptionMappingConfig exte
         }
 
         public ExceptionMappingConfig build() {
-            target.params = Collections.unmodifiableMap(target.params);
+            embalmTarget();
             ExceptionMappingConfig result = target;
             target = new ExceptionMappingConfig(target);
             return result;
         }
+
+        protected void embalmTarget() {
+            target.params = Collections.unmodifiableMap(target.params);
+        }
     }
 
 }

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/InterceptorConfig.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/InterceptorConfig.java?rev=1066692&r1=1066691&r2=1066692&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/InterceptorConfig.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/InterceptorConfig.java
Wed Feb  2 23:27:33 2011
@@ -32,10 +32,9 @@ import java.util.Map;
  */
 public class InterceptorConfig extends Located implements Serializable {
 
-    Map<String,String> params;
-    String className;
-    String name;
-
+    protected Map<String,String> params;
+    protected String className;
+    protected String name;
 
     protected InterceptorConfig(String name, String className) {
         this.params = new LinkedHashMap<String,String>();
@@ -49,7 +48,6 @@ public class InterceptorConfig extends L
         this.params = new LinkedHashMap<String,String>(orig.params);
     }
 
-
     public String getClassName() {
         return className;
     }
@@ -106,7 +104,7 @@ public class InterceptorConfig extends L
      * After setting any values you need, call the {@link #build()} method to create the
object.
      */
     public static final class Builder {
-        private InterceptorConfig target;
+        protected InterceptorConfig target;
 
         public Builder(String name, String className) {
             target = new InterceptorConfig(name, className);
@@ -142,10 +140,14 @@ public class InterceptorConfig extends L
         }
 
         public InterceptorConfig build() {
-            target.params = Collections.unmodifiableMap(target.params);
+            embalmTarget();
             InterceptorConfig result = target;
             target = new InterceptorConfig(target);
             return result;
         }
+
+        protected void embalmTarget() {
+            target.params = Collections.unmodifiableMap(target.params);
+        }
     }
 }

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/InterceptorStackConfig.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/InterceptorStackConfig.java?rev=1066692&r1=1066691&r2=1066692&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/InterceptorStackConfig.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/InterceptorStackConfig.java
Wed Feb  2 23:27:33 2011
@@ -40,9 +40,8 @@ public class InterceptorStackConfig exte
     /**
      * A list of InterceptorMapping object
      */
-    private List<InterceptorMapping> interceptors;
-    private String name;
-
+    protected List<InterceptorMapping> interceptors;
+    protected String name;
 
     /**
      * Creates an InterceptorStackConfig object.
@@ -130,7 +129,7 @@ public class InterceptorStackConfig exte
      * After setting any values you need, call the {@link #build()} method to create the
object.
      */
     public static class Builder implements InterceptorListHolder {
-        private InterceptorStackConfig target;
+        protected InterceptorStackConfig target;
 
         public Builder(String name) {
             target = new InterceptorStackConfig();
@@ -164,10 +163,14 @@ public class InterceptorStackConfig exte
         }
 
         public InterceptorStackConfig build() {
-            target.interceptors = Collections.unmodifiableList(target.interceptors);
+            embalmTarget();
             InterceptorStackConfig result = target;
             target = new InterceptorStackConfig(target);
             return result;
         }
+
+        protected void embalmTarget() {
+            target.interceptors = Collections.unmodifiableList(target.interceptors);
+        }
     }
 }

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java?rev=1066692&r1=1066691&r2=1066692&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/PackageConfig.java
Wed Feb  2 23:27:33 2011
@@ -36,21 +36,20 @@ public class PackageConfig extends Locat
 
     private static final Logger LOG = LoggerFactory.getLogger(PackageConfig.class);
 
-    private Map<String, ActionConfig> actionConfigs;
-    private Map<String, ResultConfig> globalResultConfigs;
-    private Map<String, Object> interceptorConfigs;
-    private Map<String, ResultTypeConfig> resultTypeConfigs;
-    private List<ExceptionMappingConfig> globalExceptionMappingConfigs;
-    private List<PackageConfig> parents;
-    private String defaultInterceptorRef;
-    private String defaultActionRef;
-    private String defaultResultType;
-    private String defaultClassRef;
-    private String name;
-    private String namespace = "";
-    private boolean isAbstract = false;
-    private boolean needsRefresh;
-
+    protected Map<String, ActionConfig> actionConfigs;
+    protected Map<String, ResultConfig> globalResultConfigs;
+    protected Map<String, Object> interceptorConfigs;
+    protected Map<String, ResultTypeConfig> resultTypeConfigs;
+    protected List<ExceptionMappingConfig> globalExceptionMappingConfigs;
+    protected List<PackageConfig> parents;
+    protected String defaultInterceptorRef;
+    protected String defaultActionRef;
+    protected String defaultResultType;
+    protected String defaultClassRef;
+    protected String name;
+    protected String namespace = "";
+    protected boolean isAbstract = false;
+    protected boolean needsRefresh;
 
     protected PackageConfig(String name) {
         this.name = name;
@@ -62,7 +61,6 @@ public class PackageConfig extends Locat
         parents = new ArrayList<PackageConfig>();
     }
 
-
     protected PackageConfig(PackageConfig orig) {
         this.defaultInterceptorRef = orig.defaultInterceptorRef;
         this.defaultActionRef = orig.defaultActionRef;
@@ -444,7 +442,7 @@ public class PackageConfig extends Locat
      */
     public static class Builder implements InterceptorLocator {
 
-        private PackageConfig target;
+        protected PackageConfig target;
 
         public Builder(String name) {
             target = new PackageConfig(name);
@@ -588,23 +586,24 @@ public class PackageConfig extends Locat
             return target.getAllResultTypeConfigs().get(type);
         }
 
-
-
         public Object getInterceptorConfig(String name) {
             return target.getAllInterceptorConfigs().get(name);
         }
 
         public PackageConfig build() {
+            embalmTarget();
+            PackageConfig result = target;
+            target = new PackageConfig(result);
+            return result;
+        }
+
+        protected void embalmTarget() {
             target.actionConfigs = Collections.unmodifiableMap(target.actionConfigs);
             target.globalResultConfigs = Collections.unmodifiableMap(target.globalResultConfigs);
             target.interceptorConfigs = Collections.unmodifiableMap(target.interceptorConfigs);
             target.resultTypeConfigs = Collections.unmodifiableMap(target.resultTypeConfigs);
             target.globalExceptionMappingConfigs = Collections.unmodifiableList(target.globalExceptionMappingConfigs);
             target.parents = Collections.unmodifiableList(target.parents);
-
-            PackageConfig result = target;
-            target = new PackageConfig(result);
-            return result;
         }
 
         @Override

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ResultConfig.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ResultConfig.java?rev=1066692&r1=1066691&r2=1066692&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ResultConfig.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ResultConfig.java
Wed Feb  2 23:27:33 2011
@@ -33,10 +33,9 @@ import java.util.Map;
  */
 public class ResultConfig extends Located implements Serializable {
 
-    private Map<String,String> params;
-    private String className;
-    private String name;
-
+    protected Map<String,String> params;
+    protected String className;
+    protected String name;
 
     protected ResultConfig(String name, String className) {
         this.name = name;
@@ -62,7 +61,6 @@ public class ResultConfig extends Locate
         return params;
     }
 
-
     @Override
     public boolean equals(Object o) {
         if (this == o) {
@@ -106,7 +104,7 @@ public class ResultConfig extends Locate
      * After setting any values you need, call the {@link #build()} method to create the
object.
      */
     public static final class Builder {
-        private ResultConfig target;
+        protected ResultConfig target;
 
         public Builder(String name, String className) {
             target = new ResultConfig(name, className);
@@ -142,10 +140,14 @@ public class ResultConfig extends Locate
         }
 
         public ResultConfig build() {
-            target.params = Collections.unmodifiableMap(target.params);
+            embalmTarget();
             ResultConfig result = target;
             target = new ResultConfig(target);
             return result;
         }
+
+        protected void embalmTarget() {
+            target.params = Collections.unmodifiableMap(target.params);
+        }
     }
 }

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ResultTypeConfig.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ResultTypeConfig.java?rev=1066692&r1=1066691&r2=1066692&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ResultTypeConfig.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/entities/ResultTypeConfig.java
Wed Feb  2 23:27:33 2011
@@ -35,11 +35,10 @@ import java.util.Map;
  */
 public class ResultTypeConfig extends Located implements Serializable {
 
-    private String className;
-    private String name;
-    private String defaultResultParam;
-
-    private Map<String,String> params;
+    protected String className;
+    protected String name;
+    protected String defaultResultParam;
+    protected Map<String,String> params;
 
     protected ResultTypeConfig(String name, String className) {
         this.name = name;
@@ -54,13 +53,12 @@ public class ResultTypeConfig extends Lo
         this.params = orig.params;
     }
 
-
     public void setDefaultResultParam(String defaultResultParam) {
-    	this.defaultResultParam = defaultResultParam;
+        this.defaultResultParam = defaultResultParam;
     }
     
     public String getDefaultResultParam() {
-    	return this.defaultResultParam;
+        return this.defaultResultParam;
     }
 
     /**
@@ -111,7 +109,7 @@ public class ResultTypeConfig extends Lo
      * After setting any values you need, call the {@link #build()} method to create the
object.
      */
     public static final class Builder {
-        private ResultTypeConfig target;
+        protected ResultTypeConfig target;
 
         public Builder(String name, String className) {
             target = new ResultTypeConfig(name, className);
@@ -152,10 +150,14 @@ public class ResultTypeConfig extends Lo
         }
 
         public ResultTypeConfig build() {
-            target.params = Collections.unmodifiableMap(target.params);
+            embalmTarget();
             ResultTypeConfig result = target;
             target = new ResultTypeConfig(target);
             return result;
         }
+
+        protected void embalmTarget() {
+            target.params = Collections.unmodifiableMap(target.params);
+        }
     }
 }



Mime
View raw message