1:
37:
38: package ;
39:
40: import ;
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46:
47:
52: public class TypeLibrary
53: implements DatatypeLibrary
54: {
55:
56: public static final SimpleType ANY_SIMPLE_TYPE = new AnySimpleType();
57:
58: public static final SimpleType STRING = new StringType();
59: public static final SimpleType BOOLEAN = new BooleanType();
60: public static final SimpleType DECIMAL = new DecimalType();
61: public static final SimpleType FLOAT = new FloatType();
62: public static final SimpleType DOUBLE = new DoubleType();
63: public static final SimpleType DURATION = new DurationType();
64: public static final SimpleType DATE_TIME = new DateTimeType();
65: public static final SimpleType TIME = new TimeType();
66: public static final SimpleType DATE = new DateType();
67: public static final SimpleType G_YEAR_MONTH = new GYearMonthType();
68: public static final SimpleType G_YEAR = new GYearType();
69: public static final SimpleType G_MONTH_DAY = new GMonthDayType();
70: public static final SimpleType G_DAY = new GDayType();
71: public static final SimpleType G_MONTH = new GMonthType();
72: public static final SimpleType HEX_BINARY = new HexBinaryType();
73: public static final SimpleType BASE64_BINARY = new Base64BinaryType();
74: public static final SimpleType ANY_URI = new AnyURIType();
75: public static final SimpleType QNAME = new QNameType();
76: public static final SimpleType NOTATION = new NotationType();
77:
78: public static final SimpleType NORMALIZED_STRING = new NormalizedStringType();
79: public static final SimpleType TOKEN = new TokenType();
80: public static final SimpleType LANGUAGE = new LanguageType();
81: public static final SimpleType NMTOKEN = new NMTokenType();
82: public static final SimpleType NMTOKENS = new NMTokensType();
83: public static final SimpleType NAME = new NameType();
84: public static final SimpleType NCNAME = new NCNameType();
85: public static final SimpleType ID = new IDType();
86: public static final SimpleType IDREF = new IDRefType();
87: public static final SimpleType IDREFS = new IDRefsType();
88: public static final SimpleType ENTITY = new EntityType();
89: public static final SimpleType ENTITIES = new EntitiesType();
90: public static final SimpleType INTEGER = new IntegerType();
91: public static final SimpleType NON_POSITIVE_INTEGER = new NonPositiveIntegerType();
92: public static final SimpleType NEGATIVE_INTEGER = new NegativeIntegerType();
93: public static final SimpleType LONG = new LongType();
94: public static final SimpleType INT = new IntType();
95: public static final SimpleType SHORT = new ShortType();
96: public static final SimpleType BYTE = new ByteType();
97: public static final SimpleType NON_NEGATIVE_INTEGER = new NonNegativeIntegerType();
98: public static final SimpleType UNSIGNED_LONG = new UnsignedLongType();
99: public static final SimpleType UNSIGNED_INT = new UnsignedIntType();
100: public static final SimpleType UNSIGNED_SHORT = new UnsignedShortType();
101: public static final SimpleType UNSIGNED_BYTE = new UnsignedByteType();
102: public static final SimpleType POSITIVE_INTEGER = new PositiveIntegerType();
103:
104: private static Map byName;
105: static
106: {
107: byName = new HashMap();
108: byName.put("anySimpleType", ANY_SIMPLE_TYPE);
109: byName.put("string", STRING);
110: byName.put("boolean", BOOLEAN);
111: byName.put("decimal", DECIMAL);
112: byName.put("float", FLOAT);
113: byName.put("double", DOUBLE);
114: byName.put("duration", DURATION);
115: byName.put("dateTime", DATE_TIME);
116: byName.put("time", TIME);
117: byName.put("date", DATE);
118: byName.put("gYearMonth", G_YEAR_MONTH);
119: byName.put("gYear", G_YEAR);
120: byName.put("gMonthDay", G_MONTH_DAY);
121: byName.put("gDay", G_DAY);
122: byName.put("gMonth",G_MONTH);
123: byName.put("hexBinary", HEX_BINARY);
124: byName.put("base64Binary", BASE64_BINARY);
125: byName.put("anyURI", ANY_URI);
126: byName.put("QName", QNAME);
127: byName.put("NOTATION", NOTATION);
128: byName.put("normalizedString", NORMALIZED_STRING);
129: byName.put("token", TOKEN);
130: byName.put("language", LANGUAGE);
131: byName.put("NMTOKEN", NMTOKEN);
132: byName.put("NMTOKENS", NMTOKENS);
133: byName.put("Name", NAME);
134: byName.put("NCName", NCNAME);
135: byName.put("ID", ID);
136: byName.put("IDREF", IDREF);
137: byName.put("IDREFS", IDREFS);
138: byName.put("ENTITY", ENTITY);
139: byName.put("ENTITIES", ENTITIES);
140: byName.put("integer", INTEGER);
141: byName.put("nonPositiveInteger", NON_POSITIVE_INTEGER);
142: byName.put("negativeInteger", NEGATIVE_INTEGER);
143: byName.put("long", LONG);
144: byName.put("int", INT);
145: byName.put("short", SHORT);
146: byName.put("byte", BYTE);
147: byName.put("nonNegativeInteger", NON_NEGATIVE_INTEGER);
148: byName.put("unsignedLong", UNSIGNED_LONG);
149: byName.put("unsignedInt", UNSIGNED_INT);
150: byName.put("unsignedShort", UNSIGNED_SHORT);
151: byName.put("unsignedByte", UNSIGNED_BYTE);
152: byName.put("positiveInteger", POSITIVE_INTEGER);
153: }
154:
155: public DatatypeBuilder createDatatypeBuilder(String baseTypeLocalName)
156: throws DatatypeException
157: {
158: SimpleType type = (SimpleType) byName.get(baseTypeLocalName);
159: if (type == null)
160: throw new DatatypeException("Unknown type name: " + baseTypeLocalName);
161: return new TypeBuilder(type);
162: }
163:
164: public Datatype createDatatype(String typeLocalName)
165: throws DatatypeException
166: {
167: SimpleType type = (SimpleType) byName.get(typeLocalName);
168: if (type == null)
169: throw new DatatypeException("Unknown type name: " + typeLocalName);
170: return type;
171: }
172:
173: }