1 19 package org.enhydra.zeus.binding; 20 21 import java.util.Iterator ; 22 import java.util.LinkedList ; 23 import java.util.List ; 24 25 42 public abstract class BaseContainer extends BaseBinding implements Container { 43 44 48 protected List properties; 49 50 65 public void addProperty(Property property) { 66 if (property == null) { 67 throw new IllegalArgumentException ("A Container cannot have " + 68 "null properties as children."); 69 } 70 71 if (properties == null) { 72 properties = new LinkedList (); 73 } 74 75 properties.add(property); 76 } 77 78 94 public boolean removeProperty(String javaName) { 95 if (properties == null) { 96 return false; 97 } 98 99 for (Iterator i = properties.iterator(); i.hasNext(); ) { 100 Property property = (Property)i.next(); 101 if (property.getJavaName().equals(javaName)) { 102 i.remove(); 103 return true; 104 } 105 } 106 107 return false; 108 } 109 110 120 public void setProperties(List properties) { 121 if (properties == null) { 122 throw new IllegalArgumentException ("A Container cannot have a " + 123 "null property set."); 124 } 125 126 this.properties = properties; 127 } 128 129 140 public List getProperties() { 141 if (properties == null) { 142 return new LinkedList (); 143 } 144 145 return properties; 146 } 147 148 153 public void clearProperties() { 154 if (properties != null) { 155 properties.clear(); 156 } 157 } 158 } 159 | Popular Tags |