Method from org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem Detail: |
public SchemaAnnotation[] annotations() {
return EMPTY_SCHEMAANNOTATION_ARRAY;
}
|
public SchemaAttributeGroup[] attributeGroups() {
return EMPTY_SCHEMAATTRIBUTEGROUP_ARRAY;
}
Returns the attribute groups defined in this loader. |
public SchemaType[] attributeTypes() {
return EMPTY_SCHEMATYPE_ARRAY;
}
Returns the attribute types defined in this loader. |
public SchemaType[] documentTypes() {
return EMPTY_SCHEMATYPE_ARRAY;
}
Returns the document types defined in this loader. |
public void fillInType(int btc) {
SchemaTypeImpl result = getBuiltinType(btc);
SchemaType base;
SchemaType item = null;
int variety = SchemaType.ATOMIC;
int derivationType = SchemaType.DT_RESTRICTION;
switch (btc)
{
case SchemaType.BTC_NOT_BUILTIN:
variety = SchemaType.NOT_SIMPLE;
base = ST_ANY_TYPE;
break;
case SchemaType.BTC_ANY_TYPE:
variety = SchemaType.NOT_SIMPLE;
base = null;
derivationType = SchemaType.DT_RESTRICTION;
break;
default:
assert(false);
case SchemaType.BTC_ANY_SIMPLE:
base = ST_ANY_TYPE; break;
case SchemaType.BTC_BOOLEAN:
case SchemaType.BTC_BASE_64_BINARY:
case SchemaType.BTC_HEX_BINARY:
case SchemaType.BTC_ANY_URI:
case SchemaType.BTC_QNAME:
case SchemaType.BTC_NOTATION:
case SchemaType.BTC_FLOAT:
case SchemaType.BTC_DOUBLE:
case SchemaType.BTC_DECIMAL:
case SchemaType.BTC_STRING:
case SchemaType.BTC_DURATION:
case SchemaType.BTC_DATE_TIME:
case SchemaType.BTC_TIME:
case SchemaType.BTC_DATE:
case SchemaType.BTC_G_YEAR_MONTH:
case SchemaType.BTC_G_YEAR:
case SchemaType.BTC_G_MONTH_DAY:
case SchemaType.BTC_G_DAY:
case SchemaType.BTC_G_MONTH:
base = ST_ANY_SIMPLE; break;
// derived numerics
case SchemaType.BTC_INTEGER:
base = ST_DECIMAL; break;
case SchemaType.BTC_LONG:
base = ST_INTEGER; break;
case SchemaType.BTC_INT:
base = ST_LONG; break;
case SchemaType.BTC_SHORT:
base = ST_INT; break;
case SchemaType.BTC_BYTE:
base = ST_SHORT; break;
case SchemaType.BTC_NON_POSITIVE_INTEGER:
base = ST_INTEGER; break;
case SchemaType.BTC_NEGATIVE_INTEGER:
base = ST_NON_POSITIVE_INTEGER; break;
case SchemaType.BTC_NON_NEGATIVE_INTEGER:
base = ST_INTEGER; break;
case SchemaType.BTC_POSITIVE_INTEGER:
base = ST_NON_NEGATIVE_INTEGER; break;
case SchemaType.BTC_UNSIGNED_LONG:
base = ST_NON_NEGATIVE_INTEGER; break;
case SchemaType.BTC_UNSIGNED_INT:
base = ST_UNSIGNED_LONG; break;
case SchemaType.BTC_UNSIGNED_SHORT:
base = ST_UNSIGNED_INT; break;
case SchemaType.BTC_UNSIGNED_BYTE:
base = ST_UNSIGNED_SHORT; break;
// derived strings
case SchemaType.BTC_NORMALIZED_STRING:
base = ST_STRING; break;
case SchemaType.BTC_TOKEN:
base = ST_NORMALIZED_STRING; break;
case SchemaType.BTC_NAME:
base = ST_TOKEN; break;
case SchemaType.BTC_NCNAME:
base = ST_NAME; break;
case SchemaType.BTC_ID:
case SchemaType.BTC_IDREF:
case SchemaType.BTC_ENTITY:
base = ST_NCNAME; break;
case SchemaType.BTC_LANGUAGE:
case SchemaType.BTC_NMTOKEN:
base = ST_TOKEN; break;
case SchemaType.BTC_IDREFS:
case SchemaType.BTC_ENTITIES:
case SchemaType.BTC_NMTOKENS:
variety = SchemaType.LIST;
base = ST_ANY_SIMPLE;
if (btc == SchemaType.BTC_IDREFS)
item = ST_IDREF;
else if (btc == SchemaType.BTC_ENTITIES)
item = ST_ENTITY;
else
item = ST_NMTOKEN;
break;
}
result.setDerivationType(derivationType);
result.setSimpleTypeVariety(variety);
if (variety != SchemaType.NOT_SIMPLE)
{
result.setSimpleType(true);
}
else
{
assert (btc == SchemaType.BTC_ANY_TYPE || btc == SchemaType.BTC_NOT_BUILTIN);
}
result.setBaseTypeRef(base == null ? null : base.getRef());
result.setBaseDepth(base == null ? 0 : ((SchemaTypeImpl)base).getBaseDepth() + 1);
result.setListItemTypeRef(item == null ? null : item.getRef());
if (btc >= SchemaType.BTC_FIRST_PRIMITIVE && btc < = SchemaType.BTC_LAST_PRIMITIVE)
result.setPrimitiveTypeRef(result.getRef());
else if (variety == SchemaType.ATOMIC)
{
if (base == null)
throw new IllegalStateException("Base was null for " + btc);
if (base.getPrimitiveType() == null)
throw new IllegalStateException("Base.gpt was null for " + btc);
result.setPrimitiveTypeRef(base.getPrimitiveType().getRef());
}
XmlValueRef[] facets;
boolean[] fixedf;
int wsr = SchemaType.WS_COLLAPSE;
int decimalSize = SchemaType.NOT_DECIMAL;
// now set up facets
switch (btc)
{
default:
assert(false);
case SchemaType.BTC_ANY_TYPE:
case SchemaType.BTC_ANY_SIMPLE:
case SchemaType.BTC_NOT_BUILTIN:
facets = FACETS_NONE;
fixedf = FIXED_FACETS_NONE;
wsr = SchemaType.WS_UNSPECIFIED;
break;
case SchemaType.BTC_STRING:
facets = FACETS_WS_PRESERVE;
fixedf = FIXED_FACETS_NONE;
wsr = SchemaType.WS_PRESERVE;
break;
case SchemaType.BTC_BOOLEAN:
case SchemaType.BTC_BASE_64_BINARY:
case SchemaType.BTC_HEX_BINARY:
case SchemaType.BTC_ANY_URI:
case SchemaType.BTC_QNAME:
case SchemaType.BTC_FLOAT:
case SchemaType.BTC_DOUBLE:
case SchemaType.BTC_NOTATION:
case SchemaType.BTC_DURATION:
case SchemaType.BTC_DATE_TIME:
case SchemaType.BTC_TIME:
case SchemaType.BTC_DATE:
case SchemaType.BTC_G_YEAR_MONTH:
case SchemaType.BTC_G_YEAR:
case SchemaType.BTC_G_MONTH_DAY:
case SchemaType.BTC_G_DAY:
case SchemaType.BTC_G_MONTH:
facets = FACETS_WS_COLLAPSE;
fixedf = FIXED_FACETS_WS;
break;
case SchemaType.BTC_DECIMAL:
facets = FACETS_WS_COLLAPSE;
fixedf = FIXED_FACETS_WS;
decimalSize = SchemaType.SIZE_BIG_DECIMAL;
break;
// derived numerics
case SchemaType.BTC_INTEGER:
facets = FACETS_INTEGER;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_BIG_INTEGER;
break;
case SchemaType.BTC_LONG:
facets = FACETS_LONG;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_LONG;
break;
case SchemaType.BTC_INT:
facets = FACETS_INT;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_INT;
break;
case SchemaType.BTC_SHORT:
facets = FACETS_SHORT;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_SHORT;
break;
case SchemaType.BTC_BYTE:
facets = FACETS_BYTE;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_BYTE;
break;
case SchemaType.BTC_NON_POSITIVE_INTEGER:
facets = FACETS_NONPOSITIVE;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_BIG_INTEGER;
break;
case SchemaType.BTC_NEGATIVE_INTEGER:
facets = FACETS_NEGATIVE;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_BIG_INTEGER;
break;
case SchemaType.BTC_NON_NEGATIVE_INTEGER:
facets = FACETS_NONNEGATIVE;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_BIG_INTEGER;
break;
case SchemaType.BTC_POSITIVE_INTEGER:
facets = FACETS_POSITIVE;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_BIG_INTEGER;
break;
case SchemaType.BTC_UNSIGNED_LONG:
facets = FACETS_UNSIGNED_LONG;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_BIG_INTEGER;
break;
case SchemaType.BTC_UNSIGNED_INT:
facets = FACETS_UNSIGNED_INT;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_LONG;
break;
case SchemaType.BTC_UNSIGNED_SHORT:
facets = FACETS_UNSIGNED_SHORT;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_INT;
break;
case SchemaType.BTC_UNSIGNED_BYTE:
facets = FACETS_UNSIGNED_BYTE;
fixedf = FIXED_FACETS_INTEGER;
decimalSize = SchemaType.SIZE_SHORT;
break;
// derived strings
case SchemaType.BTC_NORMALIZED_STRING:
facets = FACETS_WS_REPLACE;
fixedf = FIXED_FACETS_NONE;
wsr = SchemaType.WS_REPLACE;
break;
case SchemaType.BTC_TOKEN:
case SchemaType.BTC_NAME:
case SchemaType.BTC_NCNAME:
case SchemaType.BTC_LANGUAGE:
case SchemaType.BTC_ID:
case SchemaType.BTC_IDREF:
case SchemaType.BTC_IDREFS:
case SchemaType.BTC_ENTITY:
case SchemaType.BTC_NMTOKEN:
facets = FACETS_WS_COLLAPSE;
fixedf = FIXED_FACETS_NONE;
wsr = SchemaType.WS_COLLAPSE;
break;
case SchemaType.BTC_ENTITIES:
case SchemaType.BTC_NMTOKENS:
facets = FACETS_BUILTIN_LIST;
fixedf = FIXED_FACETS_NONE;
wsr = SchemaType.WS_UNSPECIFIED;
break;
}
// fundamental facets
int ordered = SchemaType.UNORDERED;
boolean isNumeric = false;
boolean isFinite = false;
boolean isBounded = false;
switch (btc)
{
default:
assert(false);
case SchemaType.BTC_ANY_TYPE:
case SchemaType.BTC_NOT_BUILTIN:
case SchemaType.BTC_ANY_SIMPLE:
case SchemaType.BTC_STRING:
case SchemaType.BTC_BASE_64_BINARY:
case SchemaType.BTC_HEX_BINARY:
case SchemaType.BTC_ANY_URI:
case SchemaType.BTC_QNAME:
case SchemaType.BTC_NOTATION:
case SchemaType.BTC_NORMALIZED_STRING:
case SchemaType.BTC_TOKEN:
case SchemaType.BTC_NAME:
case SchemaType.BTC_NCNAME:
case SchemaType.BTC_LANGUAGE:
case SchemaType.BTC_ID:
case SchemaType.BTC_IDREF:
case SchemaType.BTC_IDREFS:
case SchemaType.BTC_ENTITY:
case SchemaType.BTC_NMTOKEN:
case SchemaType.BTC_ENTITIES:
case SchemaType.BTC_NMTOKENS:
break;
case SchemaType.BTC_BOOLEAN:
isFinite = true;
break;
case SchemaType.BTC_FLOAT:
case SchemaType.BTC_DOUBLE:
case SchemaType.BTC_DECIMAL:
case SchemaType.BTC_INTEGER:
isNumeric = true;
ordered = SchemaType.TOTAL_ORDER;
break;
case SchemaType.BTC_DURATION:
case SchemaType.BTC_DATE_TIME:
case SchemaType.BTC_TIME:
case SchemaType.BTC_DATE:
case SchemaType.BTC_G_YEAR_MONTH:
case SchemaType.BTC_G_YEAR:
case SchemaType.BTC_G_MONTH_DAY:
case SchemaType.BTC_G_DAY:
case SchemaType.BTC_G_MONTH:
ordered = SchemaType.PARTIAL_ORDER;
break;
case SchemaType.BTC_LONG:
case SchemaType.BTC_INT:
case SchemaType.BTC_SHORT:
case SchemaType.BTC_BYTE:
case SchemaType.BTC_NON_POSITIVE_INTEGER:
case SchemaType.BTC_NEGATIVE_INTEGER:
case SchemaType.BTC_NON_NEGATIVE_INTEGER:
case SchemaType.BTC_POSITIVE_INTEGER:
case SchemaType.BTC_UNSIGNED_LONG:
case SchemaType.BTC_UNSIGNED_INT:
case SchemaType.BTC_UNSIGNED_SHORT:
case SchemaType.BTC_UNSIGNED_BYTE:
isNumeric = true;
ordered = SchemaType.TOTAL_ORDER;
isFinite = true;
isBounded = true;
break;
}
result.setBasicFacets(facets, fixedf);
result.setWhiteSpaceRule(wsr);
result.setOrdered(ordered);
result.setBounded(isBounded);
result.setNumeric(isNumeric);
result.setFinite(isFinite);
result.setDecimalSize(decimalSize);
result.setAnonymousTypeRefs(EMPTY_SCHEMATYPEREF_ARRAY);
String pattern = null;
boolean hasPattern = false;
switch (btc)
{
case SchemaType.BTC_LANGUAGE:
pattern = "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"; // we used to have ([a-zA-Z]{2}|[iI]-[a-zA-Z]+|[xX]-[a-zA-Z]{1,8})(-[a-zA-Z]{1,8})*", but s4s uses the more lenient pattern to the left.
hasPattern = true;
break;
case SchemaType.BTC_NMTOKEN:
pattern = "\\c+";
hasPattern = true;
break;
case SchemaType.BTC_NAME:
pattern = "\\i\\c*";
hasPattern = true;
break;
case SchemaType.BTC_NCNAME:
pattern = "[\\i-[:]][\\c-[:]]*";
hasPattern = true;
break;
// These types inherit their patterns
case SchemaType.BTC_ID:
case SchemaType.BTC_IDREF:
case SchemaType.BTC_ENTITY:
hasPattern = true;
break;
}
if (pattern != null)
{
org.apache.xmlbeans.impl.regex.RegularExpression p = null;
try { p = org.apache.xmlbeans.impl.regex.SchemaRegularExpression.forPattern(pattern); }
catch (org.apache.xmlbeans.impl.regex.ParseException e) { assert false; }
result.setPatterns(new org.apache.xmlbeans.impl.regex.RegularExpression[] {p});
}
result.setPatternFacet(hasPattern);
// ANY_TYPE has to be able to act like a complex type
if (btc == SchemaType.BTC_ANY_TYPE)
{
SchemaParticleImpl contentModel = new SchemaParticleImpl();
contentModel.setParticleType(SchemaParticle.WILDCARD);
contentModel.setWildcardSet(QNameSet.ALL);
contentModel.setWildcardProcess(SchemaParticle.LAX);
contentModel.setMinOccurs(BigInteger.ZERO);
contentModel.setMaxOccurs(null);
contentModel.setTransitionRules(QNameSet.ALL, true);
contentModel.setTransitionNotes(QNameSet.ALL, true);
SchemaAttributeModelImpl attrModel = new SchemaAttributeModelImpl();
attrModel.setWildcardProcess(SchemaAttributeModel.LAX);
attrModel.setWildcardSet(QNameSet.ALL);
result.setComplexTypeVariety(SchemaType.MIXED_CONTENT);
result.setContentModel(contentModel, attrModel, Collections.EMPTY_MAP, Collections.EMPTY_MAP, false);
result.setAnonymousTypeRefs(EMPTY_SCHEMATYPEREF_ARRAY);
result.setWildcardSummary(QNameSet.ALL, true, QNameSet.ALL, true);
}
else if (btc == SchemaType.BTC_NOT_BUILTIN)
{
// so does the no_type : it permits no contents (and even empty contents is invalid, but that's special-cased)
SchemaParticleImpl contentModel = null; // empty
SchemaAttributeModelImpl attrModel = new SchemaAttributeModelImpl(); // empty
result.setComplexTypeVariety(SchemaType.EMPTY_CONTENT);
result.setContentModel(contentModel, attrModel, Collections.EMPTY_MAP, Collections.EMPTY_MAP, false);
result.setAnonymousTypeRefs(EMPTY_SCHEMATYPEREF_ARRAY);
result.setWildcardSummary(QNameSet.EMPTY, false, QNameSet.EMPTY, false);
}
result.setOrderSensitive(false);
}
|
public SchemaGlobalAttribute findAttribute(QName name) {
return null;
}
|
public Ref findAttributeGroupRef(QName name) {
return null;
}
|
public Ref findAttributeRef(QName name) {
return null;
}
|
public SchemaType findAttributeType(QName name) {
return null;
}
|
public Ref findAttributeTypeRef(QName name) {
return null;
}
|
public SchemaType findDocumentType(QName name) {
return null;
}
|
public Ref findDocumentTypeRef(QName name) {
return null;
}
|
public SchemaGlobalElement findElement(QName name) {
return null;
}
|
public Ref findElementRef(QName name) {
return null;
}
|
public Ref findIdentityConstraintRef(QName name) {
return null;
}
|
public Ref findModelGroupRef(QName name) {
return null;
}
|
public SchemaType findType(QName name) {
return (SchemaType)_typeMap.get(name);
}
|
public Ref findTypeRef(QName name) {
SchemaType type = findType(name);
return (type == null ? null : type.getRef());
}
|
public static SchemaTypeSystem get() {
return _global;
}
|
public ClassLoader getClassLoader() {
return BuiltinSchemaTypeSystem.class.getClassLoader();
}
Returns the classloader used by this loader for resolving types. |
public String getName() {
return "schema.typesystem.builtin";
}
Returns the name of this loader. |
public static SchemaType getNoType() {
return ST_NO_TYPE;
}
|
public InputStream getSourceAsStream(String sourceName) {
return null; // builtin schema type system has no source.
}
|
public SchemaGlobalAttribute[] globalAttributes() {
return EMPTY_SCHEMAATTRIBUTE_ARRAY;
}
Returns the global attributes defined in this loader. |
public SchemaGlobalElement[] globalElements() {
return EMPTY_SCHEMAELEMENT_ARRAY;
}
Returns the global elements defined in this loader. |
public SchemaType[] globalTypes() {
SchemaType[] result = new SchemaType[_typeArray.length - 1];
System.arraycopy(_typeArray, 1, result, 0, result.length);
return result;
}
Returns the global types defined in this loader. |
public String handleForType(SchemaType type) {
return (String)_objectsToHandles.get(type);
}
Returns the handle for the given type within this loader. |
public boolean isNamespaceDefined(String namespace) {
return namespace.equals("http://www.w3.org/2001/XMLSchema");
}
|
public SchemaModelGroup[] modelGroups() {
return EMPTY_SCHEMAMODELGROUP_ARRAY;
}
Returns the model groups defined in this loader. |
public void resolve() {
// we're born resolved and don't need to do anything.
}
|
public SchemaComponent resolveHandle(String handle) {
return (SchemaComponent)_handlesToObjects.get(handle);
}
|
public void save(Filer filer) {
throw new UnsupportedOperationException("The builtin schema type system cannot be saved.");
}
Saves this type system using a Filer |
public void saveToDirectory(File classDir) {
throw new UnsupportedOperationException("The builtin schema type system cannot be saved.");
}
Saves this type to a directory. |
public SchemaType typeForClassname(String classname) {
return (SchemaType)_typesByClassname.get(classname);
}
|
public SchemaType typeForHandle(String handle) {
return (SchemaType)_handlesToObjects.get(handle);
}
|