1 23 24 package com.sun.enterprise.cli.framework; 25 26 27 import java.util.Vector ; 28 import java.io.Serializable ; 29 30 34 public class ValidOption implements Serializable 35 { 36 37 private String name; 39 private Vector shortNames = new Vector (); 41 private String type; 43 private int required; 45 private String defaultValue = null; 47 private String deprecatedOption = null; 49 50 public static final int REQUIRED = 1; 52 public static final int OPTIONAL = 2; 54 public static final int NOT_REQUIRED = 3; 56 57 58 59 public ValidOption() 60 { 61 } 62 63 64 71 public ValidOption(String name, String type, int required, 72 String defaultValue ) 73 { 74 this.name = name; 75 this.type = type; 76 this.required = required; 77 this.defaultValue = defaultValue; 78 } 79 80 81 84 public ValidOption(ValidOption vo) 85 { 86 this.name = vo.name; 87 this.shortNames = vo.shortNames; 88 this.type = vo.type; 89 this.required = vo.required; 90 this.defaultValue = vo.defaultValue; 91 this.deprecatedOption = vo.deprecatedOption; 92 } 93 94 95 96 100 public String getName() 101 { 102 return name; 103 } 104 105 106 110 public void setName(String name) 111 { 112 this.name = name; 113 } 114 115 116 120 public Vector getShortNames() 121 { 122 return shortNames; 123 } 124 125 126 130 public void setShortName(String shortName) 131 { 132 this.shortNames.add(shortName); 133 } 134 135 136 140 public void setShortNames(Vector shortNames) 141 { 142 this.shortNames.addAll(shortNames); 143 } 144 145 146 150 public String getType() 151 { 152 return type; 153 } 154 155 156 160 public void setType(String type) 161 { 162 this.type = type; 163 } 164 165 166 170 public int isValueRequired() 171 { 172 return required; 173 } 174 175 176 180 public void setRequired(int isValueRequired) 181 { 182 required = isValueRequired; 183 } 184 185 186 190 public String getDefaultValue() 191 { 192 return defaultValue; 193 } 194 195 196 200 public void setDefaultValue(String defaultValue) 201 { 202 this.defaultValue = defaultValue; 203 } 204 205 206 210 public String getDeprecatedOption() 211 { 212 return deprecatedOption; 213 } 214 215 216 220 public void setDeprecatedOption(String deprecatedOption) 221 { 222 this.deprecatedOption = deprecatedOption; 223 } 224 225 226 230 public boolean hasDefaultValue() 231 { 232 return (defaultValue != null); 233 } 234 235 236 240 public boolean hasShortName() 241 { 242 if (shortNames.size() > 0) 243 { 244 return true; 245 } 246 return false; 247 } 248 249 250 254 public boolean hasDeprecatedOption() 255 { 256 return (deprecatedOption != null); 257 } 258 259 260 264 public String toString() 265 { 266 String shortNamesStr = ""; 267 268 for (int i = 0; i < shortNames.size(); i++) 269 { 270 shortNamesStr += shortNames.get(i) + ","; 271 } 272 return (name + " " + type + " " + shortNamesStr + " " + defaultValue); 273 } 274 } 275 | Popular Tags |