Revision: 3791
Author: [email protected]
Date: Tue Jul 27 09:09:22 2010
Log: The getChildren() method in ArchitectProject and ArchitectSwingProject now returns an unmodifiable list of children. Callers of this method should not modify this list directly; a new list backed by the returned list should be used instead if needed.

Also, the getters for children of specific types have been changed to protected. The ArchitectSwingProject is the only class that calls these methods for convenience. External classes that need to get children of specific types should simply call the generic getChildren(Class<T>) method.
http://code.google.com/p/power-architect/source/detail?r=3791

Modified:
 /trunk/src/main/java/ca/sqlpower/architect/ArchitectProject.java
/trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectSwingProject.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ArchitectProject.java Tue Jul 20 12:35:16 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/ArchitectProject.java Tue Jul 27 09:09:22 2010
@@ -100,7 +100,7 @@
      * The current integrity watcher on the project.
      */
     private SourceObjectIntegrityWatcher currentWatcher;
-
+
     /**
      * Constructs an architect project. The init method must be called
      * immediately after creating a project.
@@ -374,7 +374,7 @@
         allChildren.addAll(groups);
         allChildren.addAll(businessDefinitions);
         allChildren.addAll(formulas);
-        return allChildren;
+        return Collections.unmodifiableList(allChildren);
     }

     @NonBound
@@ -443,22 +443,22 @@
     }

     @NonProperty
-    public List<SPObjectSnapshot<?>> getSqlTypeSnapshots() {
+    protected List<SPObjectSnapshot<?>> getSqlTypeSnapshots() {
         return Collections.unmodifiableList(sqlTypeSnapshots);
     }

     @NonProperty
-    public List<DomainCategory> getDomainCategories() {
+    protected List<DomainCategory> getDomainCategories() {
         return Collections.unmodifiableList(domainCategories);
     }

     @NonProperty
-    public List<BusinessDefinition> getBusinessDefinitions() {
+    protected List<BusinessDefinition> getBusinessDefinitions() {
         return Collections.unmodifiableList(businessDefinitions);
     }

     @NonProperty
-    public List<FormulaMetricCalculation> getFormulas() {
+    protected List<FormulaMetricCalculation> getFormulas() {
         return Collections.unmodifiableList(formulas);
     }

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectSwingProject.java Tue Jul 20 08:10:07 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/ArchitectSwingProject.java Tue Jul 27 09:09:22 2010
@@ -259,7 +259,7 @@
         allChildren.addAll(getGroups());
         allChildren.addAll(getBusinessDefinitions());
         allChildren.addAll(getFormulas());
-        return allChildren;
+        return Collections.unmodifiableList(allChildren);
     }

     @NonBound

Reply via email to