1 package com.jcorporate.expresso.kernel.metadata; 2 3 66 67 import java.util.ArrayList ; 68 import java.util.Collections ; 69 import java.util.HashMap ; 70 import java.util.List ; 71 import java.util.Map ; 72 73 81 82 public class ComponentMetadata { 83 84 87 private String name; 88 89 92 private String versionNumber; 93 94 97 List nested; 98 99 102 Map properties; 103 104 107 Map methods; 108 109 112 private String description; 113 114 117 private String messageBundle; 118 119 122 private SchemaData schemaData; 123 124 127 public ComponentMetadata() { 128 nested = new ArrayList (); 129 properties = new HashMap (); 130 methods = new HashMap (); 131 } 132 133 138 public String getName() { 139 return name; 140 } 141 142 147 public void setName(String name) { 148 this.name = name; 149 } 150 151 156 public void setVersionNumber(String versionNumber) { 157 this.versionNumber = versionNumber; 158 } 159 160 165 public String getVersionNumber() { 166 return versionNumber; 167 } 168 169 176 public void setVersionNumber(String major, String minor, String micro) { 177 try { 178 Integer.parseInt(major); 179 Integer.parseInt(minor); 180 Integer.parseInt(micro); 181 } catch (NumberFormatException ex) { 182 throw new IllegalArgumentException ("ComponentMetadata.setVersionNumber: " + 183 "major, minor, and micro version strings must be parseable integers"); 184 } 185 186 versionNumber = major + "." + minor + "." + micro; 187 } 188 189 194 public void addChildComponent(ComponentMetadata newComponent) { 195 nested.add(newComponent); 196 } 197 198 203 public List getChildren() { 204 return Collections.unmodifiableList(nested); 205 } 206 207 208 213 public void setDescription(String description) { 214 this.description = description; 215 } 216 217 222 public String getDescription() { 223 return description; 224 } 225 226 231 public void addProperty(Property newValue) { 232 properties.put(newValue.getName(), newValue); 233 } 234 235 240 public void addMethod(Method newValue) { 241 methods.put(newValue.getName(), newValue); 242 } 243 244 250 public Method getMethod(String methodName) { 251 return (Method) methods.get(methodName); 252 } 253 254 259 public Map getMethods() { 260 return Collections.unmodifiableMap(methods); 261 } 262 263 268 public Map getProperties() { 269 return Collections.unmodifiableMap(properties); 270 } 271 272 281 public void setMessageBundle(String messageBundle) { 282 this.messageBundle = messageBundle; 283 } 284 285 290 public String getMessageBundle() { 291 return messageBundle; 292 } 293 294 299 public void setSchemaData(SchemaData newData) { 300 schemaData = newData; 301 } 302 303 308 public SchemaData getSchemaData() { 309 return schemaData; 310 } 311 312 } | Popular Tags |