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 ObjectThree 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"; static public final String PROPERTY_THREE = "PropertyThree"; static public final String PROPERTY_FOUR = "PropertyFour"; 44 public ObjectThree() { 45 this(Common.USE_DEFAULT_VALUES); 46 } 47 48 public ObjectThree(int options) 49 { 50 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 51 this.createProperty("property-one", PROPERTY_ONE, 54 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 55 String .class); 56 this.createProperty("property-two", PROPERTY_TWO, 58 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 59 String .class); 60 this.createProperty("property-three", PROPERTY_THREE, 62 Common.TYPE_1_N | Common.TYPE_STRING | Common.TYPE_KEY, 63 String .class); 64 this.createProperty("property-four", PROPERTY_FOUR, 66 Common.TYPE_0_N | Common.TYPE_STRING | Common.TYPE_KEY, 67 String .class); 68 this.initialize(options); 69 } 70 71 void initialize(int options) 73 { 74 75 } 76 77 public void setPropertyOne(String value) { 79 this.setValue(PROPERTY_ONE, value); 80 } 81 82 public String getPropertyOne() { 84 return (String )this.getValue(PROPERTY_ONE); 85 } 86 87 public void setPropertyTwo(String value) { 89 this.setValue(PROPERTY_TWO, value); 90 } 91 92 public String getPropertyTwo() { 94 return (String )this.getValue(PROPERTY_TWO); 95 } 96 97 public void setPropertyThree(int index, String value) { 99 this.setValue(PROPERTY_THREE, index, value); 100 } 101 102 public String getPropertyThree(int index) { 104 return (String )this.getValue(PROPERTY_THREE, index); 105 } 106 107 public void setPropertyThree(String [] value) { 109 this.setValue(PROPERTY_THREE, value); 110 } 111 112 public String [] getPropertyThree() { 114 return (String [])this.getValues(PROPERTY_THREE); 115 } 116 117 public int sizePropertyThree() { 119 return this.size(PROPERTY_THREE); 120 } 121 122 public int addPropertyThree(String value) { 124 return this.addValue(PROPERTY_THREE, value); 125 } 126 127 public int removePropertyThree(String value) { 132 return this.removeValue(PROPERTY_THREE, value); 133 } 134 135 public void setPropertyFour(int index, String value) { 137 this.setValue(PROPERTY_FOUR, index, value); 138 } 139 140 public String getPropertyFour(int index) { 142 return (String )this.getValue(PROPERTY_FOUR, index); 143 } 144 145 public void setPropertyFour(String [] value) { 147 this.setValue(PROPERTY_FOUR, value); 148 } 149 150 public String [] getPropertyFour() { 152 return (String [])this.getValues(PROPERTY_FOUR); 153 } 154 155 public int sizePropertyFour() { 157 return this.size(PROPERTY_FOUR); 158 } 159 160 public int addPropertyFour(String value) { 162 return this.addValue(PROPERTY_FOUR, value); 163 } 164 165 public int removePropertyFour(String value) { 170 return this.removeValue(PROPERTY_FOUR, value); 171 } 172 173 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 175 comparators.add(c); 176 } 177 178 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 180 comparators.remove(c); 181 } 182 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 183 boolean restrictionFailure = false; 184 if (getPropertyOne() == null) { 186 throw new org.netbeans.modules.schema2beans.ValidateException("getPropertyOne() == null", "propertyOne", this); } 188 if (getPropertyTwo() != null) { 190 } 191 if (sizePropertyThree() == 0) { 193 throw new org.netbeans.modules.schema2beans.ValidateException("sizePropertyThree() == 0", "propertyThree", this); } 195 for (int _index = 0; _index < sizePropertyThree(); ++_index) { 196 String element = getPropertyThree(_index); 197 if (element != null) { 198 } 199 } 200 for (int _index = 0; _index < sizePropertyFour(); ++_index) { 202 String element = getPropertyFour(_index); 203 if (element != null) { 204 } 205 } 206 } 207 208 public void dump(StringBuffer str, String indent){ 210 String s; 211 Object o; 212 org.netbeans.modules.schema2beans.BaseBean n; 213 str.append(indent); 214 str.append("PropertyOne"); str.append(indent+"\t"); str.append("<"); s = this.getPropertyOne(); 218 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PROPERTY_ONE, 0, str, indent); 221 222 str.append(indent); 223 str.append("PropertyTwo"); str.append(indent+"\t"); str.append("<"); s = this.getPropertyTwo(); 227 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PROPERTY_TWO, 0, str, indent); 230 231 str.append(indent); 232 str.append("PropertyThree["+this.sizePropertyThree()+"]"); for(int i=0; i<this.sizePropertyThree(); i++) 234 { 235 str.append(indent+"\t"); 236 str.append("#"+i+":"); 237 str.append(indent+"\t"); str.append("<"); s = this.getPropertyThree(i); 240 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PROPERTY_THREE, i, str, indent); 243 } 244 245 str.append(indent); 246 str.append("PropertyFour["+this.sizePropertyFour()+"]"); for(int i=0; i<this.sizePropertyFour(); i++) 248 { 249 str.append(indent+"\t"); 250 str.append("#"+i+":"); 251 str.append(indent+"\t"); str.append("<"); s = this.getPropertyFour(i); 254 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PROPERTY_FOUR, i, str, indent); 257 } 258 259 } 260 public String dumpBeanNode(){ 261 StringBuffer str = new StringBuffer (); 262 str.append("ObjectThree\n"); this.dump(str, "\n "); return str.toString(); 265 }} 266 267 269 270 363 | Popular Tags |