1 package examples.binding; 2 3 import java.util.ArrayList ; 4 import java.util.Iterator ; 5 6 public class BeanInfo { 7 ArrayList properties = new ArrayList (); 8 String name; 9 10 public BeanInfo() {} 11 public void setName(String name) { 12 this.name = name; 13 } 14 public String getName() { return name; } 15 public void addProperty(Property property) { 16 properties.add(property); 17 } 18 public Property[] getProperties() { 19 Property[] val = new Property[properties.size()]; 20 int i=0; 21 Iterator I=properties.iterator(); 22 while (I.hasNext()) { 23 val[i] = (Property) I.next(); 24 i++; 25 } 26 return val; 27 } 28 public String toString() { 29 StringBuffer b = new StringBuffer (); 30 b.append(getName()); 31 b.append(" {\n"); 32 Property[] p=getProperties(); 33 for(int i=0; i < p.length; i++) { 34 b.append(p[i]+"\n"); 35 } 36 b.append("}\n"); 37 return b.toString(); 38 } 39 40 } 41 | Popular Tags |