1 23 24 29 30 package com.sun.enterprise.tools.common.validation.data; 31 32 import org.w3c.dom.*; 33 import org.netbeans.modules.schema2beans.*; 34 import java.beans.*; 35 import java.util.*; 36 37 39 public class Parameter extends org.netbeans.modules.schema2beans.BaseBean 40 { 41 42 static Vector comparators = new Vector(); 43 44 static public final String NAME = "Name"; static public final String VALUE = "Value"; 47 public Parameter() { 48 this(Common.USE_DEFAULT_VALUES); 49 } 50 51 public Parameter(int options) 52 { 53 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 54 this.createProperty("name", NAME, 57 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 58 String .class); 59 this.createProperty("value", VALUE, 61 Common.TYPE_1_N | Common.TYPE_STRING | Common.TYPE_KEY, 62 String .class); 63 this.initialize(options); 64 } 65 66 void initialize(int options) 68 { 69 70 } 71 72 public void setName(String value) { 74 this.setValue(NAME, value); 75 } 76 77 public String getName() { 79 return (String )this.getValue(NAME); 80 } 81 82 public void setValue(int index, String value) { 84 this.setValue(VALUE, index, value); 85 } 86 87 public String getValue(int index) { 89 return (String )this.getValue(VALUE, index); 90 } 91 92 public void setValue(String [] value) { 94 this.setValue(VALUE, value); 95 } 96 97 public String [] getValue() { 99 return (String [])this.getValues(VALUE); 100 } 101 102 public int sizeValue() { 104 return this.size(VALUE); 105 } 106 107 public int addValue(String value) { 109 return this.addValue(VALUE, value); 110 } 111 112 public int removeValue(String value) { 117 return this.removeValue(VALUE, value); 118 } 119 120 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 122 comparators.add(c); 123 } 124 125 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 127 comparators.remove(c); 128 } 129 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 130 boolean restrictionFailure = false; 131 if (getName() == null) { 133 throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", "name", this); } 135 if (sizeValue() == 0) { 137 throw new org.netbeans.modules.schema2beans.ValidateException("sizeValue() == 0", "value", this); } 139 for (int _index = 0; _index < sizeValue(); ++_index) { 140 String element = getValue(_index); 141 if (element != null) { 142 } 143 } 144 } 145 146 public void dump(StringBuffer str, String indent){ 148 String s; 149 Object o; 150 org.netbeans.modules.schema2beans.BaseBean n; 151 str.append(indent); 152 str.append("Name"); str.append(indent+"\t"); str.append("<"); s = this.getName(); 156 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(NAME, 0, str, indent); 159 160 str.append(indent); 161 str.append("Value["+this.sizeValue()+"]"); for(int i=0; i<this.sizeValue(); i++) 163 { 164 str.append(indent+"\t"); 165 str.append("#"+i+":"); 166 str.append(indent+"\t"); str.append("<"); s = this.getValue(i); 169 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(VALUE, i, str, indent); 172 } 173 174 } 175 public String dumpBeanNode(){ 176 StringBuffer str = new StringBuffer (); 177 str.append("Parameter\n"); this.dump(str, "\n "); return str.toString(); 180 }} 181 182 184 185 262 | Popular Tags |