1 19 20 package org.netbeans.modules.xml.axi.datatype; 21 22 import java.util.Collections ; 23 import java.util.List ; 24 import org.netbeans.modules.xml.axi.AXIType; 25 import org.netbeans.modules.xml.axi.visitor.AXIVisitor; 26 import org.netbeans.modules.xml.schema.model.*; 27 28 34 public abstract class Datatype implements AXIType { 35 36 public enum Kind { 37 STRING("string"), 38 NORMALIZED_STRING("normalizedString"), 39 TOKEN("token"), 40 LANGUAGE("language"), 41 NAME("Name"), 42 NMTOKEN("NMTOKEN"), 43 NCNAME("NCName"), 44 NMTOKENS("NMTOKENS"), 45 ID("ID"), 46 IDREF("IDREF"), 47 ENTITY("ENTITY"), 48 IDREFS("IDREFS"), 49 ENTITIES("ENTITIES"), 50 DECIMAL("decimal"), 51 INTEGER("integer"), 52 NON_POSITIVE_INTEGER("nonPositiveInteger"), 53 LONG("long"), 54 NON_NEGATIVE_INTEGER("nonNegativeInteger"), 55 NEGATIVE_INTEGER("negativeInteger"), 56 INT("int"), 57 SHORT("short"), 58 BYTE("byte"), 59 UNSIGNED_LONG("unsignedLong"), 60 UNSIGNED_INT("unsignedInt"), 61 UNSIGNED_SHORT("unsignedShort"), 62 UNSIGNED_BYTE("unsignedByte"), 63 POSITIVE_INTEGER("positiveInteger"), 64 DURATION("duration"), 65 DATE_TIME("dateTime"), 66 TIME("time"), 67 DATE("date"), 68 G_YEAR_MONTH("gYearMonth"), 69 G_YEAR("gYear"), 70 G_MONTH_DAY("gMonthDay"), 71 G_DAY("gDay"), 72 G_MONTH("gMonth"), 73 BOOLEAN("boolean"), 74 BASE64_BINARY("base64Binary"), 75 HEX_BINARY("hexBinary"), 76 FLOAT("float"), 77 DOUBLE("double"), 78 ANYURI("anyURI"), 79 ANYTYPE("anyType"), 80 QNAME("QName"), 81 NOTATION("NOTATION"), 82 UNION("UNION"); 83 84 String name; 85 86 Kind(String name) { 87 this.name = name; 88 } 89 90 public String getName() { 91 return name; 92 } 93 } 94 95 public enum Facet { 96 LENGTH("length", Length.class), 97 MINLENGTH("minLength", MinLength.class), 98 MAXLENGTH("maxLength", MaxLength.class), 99 PATTERN("pattern", Pattern.class), 100 ENUMERATION("enumeration", Enumeration.class), 101 WHITESPACE("whiteSpace", Whitespace.class), 102 TOTATDIGITS("totalDigits", TotalDigits.class), 103 FRACTIONDIGITS("fractionDigits", FractionDigits.class), 104 MAXINCLUSIVE("maxInclusive", MaxInclusive.class), 105 MAXEXCLUSIVE("maxExclusive", MaxExclusive.class), 106 MININCLUSIVE("minInclusive", MinInclusive.class), 107 MINEXCLUSIVE("minExclusive", MinExclusive.class); 108 109 String name; 110 Class <? extends SchemaComponent> type; 111 112 Facet(String name, Class <? extends SchemaComponent> type) { 113 this.name = name; 114 this.type = type; 115 } 116 117 public String getName() { 118 return name; 119 } 120 121 public Class <? extends SchemaComponent> getComponentType() { 122 return type; 123 } 124 } 125 126 131 public abstract Kind getKind(); 132 133 138 public String getName() { 139 return getKind().getName(); 140 } 141 142 145 public void accept(AXIVisitor visitor) { 146 visitor.visit(this); 147 } 148 149 public abstract List <Facet> getApplicableFacets(); 150 151 public abstract boolean hasFacets(); 152 153 public abstract boolean isList(); 154 155 public abstract void setIsList(boolean b); 156 157 public boolean isPrimitive() { 158 return !hasFacets() && !(this instanceof UnionType); 159 } 160 161 166 public List <? extends String > getPatterns() { 167 return Collections.emptyList(); 168 } 169 170 175 public List <? extends Object > getEnumerations() { 176 return Collections.emptyList(); 177 } 178 179 184 public List <Whitespace.Treatment> getWhiteSpaces() { 185 return Collections.emptyList(); 186 } 187 188 193 public List <? extends Number > getTotalDigits() { 194 return Collections.emptyList(); 195 } 196 197 202 public List <? extends Number > getFractionDigits() { 203 return Collections.emptyList(); 204 } 205 206 211 public List <? extends Object > getMaxInclusives() { 212 return Collections.emptyList(); 213 } 214 215 220 public List <? extends Object > getMaxExclusives() { 221 return Collections.emptyList(); 222 } 223 224 229 public List <? extends Object > getMinInclusives() { 230 return Collections.emptyList(); 231 } 232 233 238 public List <? extends Object > getMinExclusives() { 239 return Collections.emptyList(); 240 } 241 242 247 public List <? extends Number > getLengths() { 248 return Collections.emptyList(); 249 } 250 251 256 public List <? extends Number > getMinLengths() { 257 return Collections.emptyList(); 258 } 259 260 265 public List <? extends Number > getMaxLengths() { 266 return Collections.emptyList(); 267 } 268 269 274 public void addPattern(String pattern) { 275 } 276 277 282 public void addEnumeration(Object enumeration) { 283 } 284 285 290 public void addWhitespace(Whitespace.Treatment whitespace) { 291 } 292 293 298 public void addTotalDigits(int totalDigits ) { 299 } 300 301 306 public void addFractionDigits(int fractionDigits) { 307 } 308 309 314 public void addMaxInclusive(Object maxInclusive) { 315 } 316 317 322 public void addMaxExclusive(Object maxExclusive) { 323 } 324 325 330 public void addMinInclusive(Object minInclusive) { 331 } 332 333 338 public void addMinExclusive(Object minExclusive) { 339 } 340 341 346 public void addLength(int length) { 347 } 348 349 354 public void addMinLength(int minLength) { 355 } 356 357 362 public void addMaxLength(int maxLength) { 363 } 364 365 370 public void removePattern(String pattern) { 371 } 372 373 378 public void removeEnumeration(Object enumeration) { 379 } 380 381 386 public void removeWhitespace(Whitespace.Treatment whitespace) { 387 } 388 389 394 public void removeTotalDigits(Number totalDigits ) { 395 } 396 397 402 public void removeFractionDigits(Number fractionDigits) { 403 } 404 405 410 public void removeMaxInclusive(Object maxInclusive) { 411 } 412 413 418 public void removeMaxExclusive(Object maxExclusive) { 419 } 420 421 426 public void removeMinInclusive(Object minInclusive) { 427 } 428 429 434 public void removeMinExclusive(Object minExclusive) { 435 } 436 437 442 public void removeLength(Number length) { 443 } 444 445 450 public void removeMinLength(Number minLength) { 451 } 452 453 458 public void removeMaxLength(Number maxLength) { 459 } 460 461 public String toString() { 462 return getName(); 463 } 464 } 465 | Popular Tags |