1 19 20 24 25 package org.netbeans.modules.j2ee.sun.validation.samples.simple.beans; 26 27 import org.w3c.dom.*; 28 import org.netbeans.modules.schema2beans.*; 29 import java.beans.*; 30 import java.util.*; 31 32 34 public class ChildObjectTwo extends org.netbeans.modules.schema2beans.BaseBean 35 { 36 37 static Vector comparators = new Vector(); 38 39 static public final String PROPERTY_ONE = "PropertyOne"; static public final String PROPERTY_TWO = "PropertyTwo"; 42 public ChildObjectTwo() { 43 this(Common.USE_DEFAULT_VALUES); 44 } 45 46 public ChildObjectTwo(int options) 47 { 48 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 49 this.createProperty("property-one", PROPERTY_ONE, 52 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 53 String .class); 54 this.createProperty("property-two", PROPERTY_TWO, 56 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 57 String .class); 58 this.initialize(options); 59 } 60 61 void initialize(int options) 63 { 64 65 } 66 67 public void setPropertyOne(String value) { 69 this.setValue(PROPERTY_ONE, value); 70 } 71 72 public String getPropertyOne() { 74 return (String )this.getValue(PROPERTY_ONE); 75 } 76 77 public void setPropertyTwo(String value) { 79 this.setValue(PROPERTY_TWO, value); 80 } 81 82 public String getPropertyTwo() { 84 return (String )this.getValue(PROPERTY_TWO); 85 } 86 87 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 89 comparators.add(c); 90 } 91 92 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 94 comparators.remove(c); 95 } 96 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 97 boolean restrictionFailure = false; 98 if (getPropertyOne() == null) { 100 throw new org.netbeans.modules.schema2beans.ValidateException("getPropertyOne() == null", "propertyOne", this); } 102 if (getPropertyTwo() == null) { 104 throw new org.netbeans.modules.schema2beans.ValidateException("getPropertyTwo() == null", "propertyTwo", this); } 106 } 107 108 public void dump(StringBuffer str, String indent){ 110 String s; 111 Object o; 112 org.netbeans.modules.schema2beans.BaseBean n; 113 str.append(indent); 114 str.append("PropertyOne"); str.append(indent+"\t"); str.append("<"); s = this.getPropertyOne(); 118 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PROPERTY_ONE, 0, str, indent); 121 122 str.append(indent); 123 str.append("PropertyTwo"); str.append(indent+"\t"); str.append("<"); s = this.getPropertyTwo(); 127 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PROPERTY_TWO, 0, str, indent); 130 131 } 132 public String dumpBeanNode(){ 133 StringBuffer str = new StringBuffer (); 134 str.append("ChildObjectTwo\n"); this.dump(str, "\n "); return str.toString(); 137 }} 138 139 141 142 235 | Popular Tags |