1 19 20 24 25 package org.netbeans.modules.j2ee.sun.validation.data; 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 Parameter extends org.netbeans.modules.schema2beans.BaseBean 35 { 36 37 static Vector comparators = new Vector(); 38 39 static public final String NAME = "Name"; static public final String VALUE = "Value"; 42 public Parameter() { 43 this(Common.USE_DEFAULT_VALUES); 44 } 45 46 public Parameter(int options) 47 { 48 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 49 this.createProperty("name", NAME, 52 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 53 String .class); 54 this.createProperty("value", VALUE, 56 Common.TYPE_1_N | 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 setName(String value) { 69 this.setValue(NAME, value); 70 } 71 72 public String getName() { 74 return (String )this.getValue(NAME); 75 } 76 77 public void setValue(int index, String value) { 79 this.setValue(VALUE, index, value); 80 } 81 82 public String getValue(int index) { 84 return (String )this.getValue(VALUE, index); 85 } 86 87 public void setValue(String [] value) { 89 this.setValue(VALUE, value); 90 } 91 92 public String [] getValue() { 94 return (String [])this.getValues(VALUE); 95 } 96 97 public int sizeValue() { 99 return this.size(VALUE); 100 } 101 102 public int addValue(String value) { 104 return this.addValue(VALUE, value); 105 } 106 107 public int removeValue(String value) { 112 return this.removeValue(VALUE, value); 113 } 114 115 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 117 comparators.add(c); 118 } 119 120 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 122 comparators.remove(c); 123 } 124 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 125 boolean restrictionFailure = false; 126 if (getName() == null) { 128 throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", "name", this); } 130 if (sizeValue() == 0) { 132 throw new org.netbeans.modules.schema2beans.ValidateException("sizeValue() == 0", "value", this); } 134 for (int _index = 0; _index < sizeValue(); ++_index) { 135 String element = getValue(_index); 136 if (element != null) { 137 } 138 } 139 } 140 141 public void dump(StringBuffer str, String indent){ 143 String s; 144 Object o; 145 org.netbeans.modules.schema2beans.BaseBean n; 146 str.append(indent); 147 str.append("Name"); str.append(indent+"\t"); str.append("<"); s = this.getName(); 151 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(NAME, 0, str, indent); 154 155 str.append(indent); 156 str.append("Value["+this.sizeValue()+"]"); for(int i=0; i<this.sizeValue(); i++) 158 { 159 str.append(indent+"\t"); 160 str.append("#"+i+":"); 161 str.append(indent+"\t"); str.append("<"); s = this.getValue(i); 164 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(VALUE, i, str, indent); 167 } 168 169 } 170 public String dumpBeanNode(){ 171 StringBuffer str = new StringBuffer (); 172 str.append("Parameter\n"); this.dump(str, "\n "); return str.toString(); 175 }} 176 177 179 180 257 | Popular Tags |