Class SchemaSetImpl.AnySimpleType
- java.lang.Object
-
- com.sun.xml.xsom.impl.ComponentImpl
-
- com.sun.xml.xsom.impl.DeclarationImpl
-
- com.sun.xml.xsom.impl.SchemaSetImpl.AnySimpleType
-
- All Implemented Interfaces:
Ref.SimpleType
,Ref.Type
,XSComponent
,XSContentType
,XSDeclaration
,XSRestrictionSimpleType
,XSSimpleType
,XSType
- Enclosing class:
- SchemaSetImpl
private class SchemaSetImpl.AnySimpleType extends DeclarationImpl implements XSRestrictionSimpleType, Ref.SimpleType
-
-
Field Summary
-
Fields inherited from class com.sun.xml.xsom.impl.ComponentImpl
ownerDocument
-
Fields inherited from interface com.sun.xml.xsom.XSType
EXTENSION, RESTRICTION, SUBSTITUTION
-
-
Constructor Summary
Constructors Constructor Description AnySimpleType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
apply(XSContentTypeFunction<T> f)
<T> T
apply(XSFunction<T> f)
Accepts a functor.<T> T
apply(XSSimpleTypeFunction<T> f)
XSComplexType
asComplexType()
Casts this object to XSComplexType if possible, otherwise returns null.XSContentType
asEmpty()
If this content type represents the empty content, returnthis
, otherwise null.XSListSimpleType
asList()
XSParticle
asParticle()
Equivalent of(this instanceof XSParticle)?this:null
XSRestrictionSimpleType
asRestriction()
XSSimpleType
asSimpleType()
Casts this object to XSSimpleType if possible, otherwise returns null.XSUnionSimpleType
asUnion()
XSListSimpleType
getBaseListType()
Gets the nearest ancestorXSListSimpleType
(including itself) if the variety of this type islist
.XSType
getBaseType()
Returns the base type of this type.XSUnionSimpleType
getBaseUnionType()
Gets the nearest ancestorXSUnionSimpleType
(including itself) if the variety of this type isunion
.XSFacet
getDeclaredFacet(java.lang.String name)
Gets the declared facet object of the given name.java.util.Collection<? extends XSFacet>
getDeclaredFacets()
Gets all the facets that are declared on this restriction.java.util.List<XSFacet>
getDeclaredFacets(java.lang.String name)
Gets the declared facets of the given name.int
getDerivationMethod()
XSFacet
getFacet(java.lang.String name)
Gets the effective facet object of the given name.java.util.List<XSFacet>
getFacets(java.lang.String name)
For multi-valued facets (enumeration and pattern), obtain all values.SchemaImpl
getOwnerSchema()
Gets a reference to theXSSchema
object to which this component belongs.XSSimpleType
getPrimitiveType()
Gets the ancestor primitiveXSSimpleType
if this type isatomic
.XSSimpleType
getRedefinedBy()
If thisXSSimpleType
is redefined by another simple type, return that component.int
getRedefinedCount()
Returns the number of complex types that redefine this component.XSSimpleType
getSimpleBaseType()
Gets the base type as XSSimpleType.XSSimpleType
getType()
Obtains a reference as a type.XSVariety
getVariety()
Gets the variety of this simple type.boolean
isComplexType()
Returns true ifthis instanceof XSComplexType
.boolean
isDerivedFrom(XSType t)
Returns true if this type is derived from the specified type.boolean
isFinal(XSVariety v)
Returns true if this type definition is marked as 'final' with respect to the givenXSVariety
.boolean
isList()
Returns true ifthis instanceof XSListSimpleType
.boolean
isPrimitive()
Returns true if this is a primitive built-in simple type (that directly derives from xs:anySimpleType, by definition.)boolean
isRestriction()
Returns true ifthis instanceof XSRestrictionSimpleType
.boolean
isSimpleType()
Returns true ifthis instanceof XSSimpleType
.boolean
isUnion()
Returns true ifthis instanceof XSUnionSimpleType
.java.util.Iterator<XSFacet>
iterateDeclaredFacets()
Iterates facets that are specified in this step of derivation.XSType[]
listSubstitutables()
Lists up types that can substitute this type by using xsi:type.void
visit(XSContentTypeVisitor visitor)
void
visit(XSSimpleTypeVisitor visitor)
void
visit(XSVisitor visitor)
Accepts a visitor.-
Methods inherited from class com.sun.xml.xsom.impl.DeclarationImpl
getName, getTargetNamespace, isAnonymous, isGlobal, isLocal
-
Methods inherited from class com.sun.xml.xsom.impl.ComponentImpl
getAnnotation, getAnnotation, getForeignAttribute, getForeignAttributes, getLocator, getRoot, getSourceDocument, select, selectSingle, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.sun.xml.xsom.XSComponent
getAnnotation, getAnnotation, getForeignAttribute, getForeignAttributes, getLocator, getRoot, getSourceDocument, select, selectSingle
-
Methods inherited from interface com.sun.xml.xsom.XSDeclaration
getName, getTargetNamespace, isAnonymous, isGlobal, isLocal
-
-
-
-
Method Detail
-
getOwnerSchema
public SchemaImpl getOwnerSchema()
Description copied from interface:XSComponent
Gets a reference to theXSSchema
object to which this component belongs.In case of
XSEmpty
component, this method returns null since there is no owner component.- Specified by:
getOwnerSchema
in interfaceXSComponent
- Overrides:
getOwnerSchema
in classComponentImpl
-
asSimpleType
public XSSimpleType asSimpleType()
Description copied from interface:XSType
Casts this object to XSSimpleType if possible, otherwise returns null.- Specified by:
asSimpleType
in interfaceXSContentType
- Specified by:
asSimpleType
in interfaceXSType
-
asComplexType
public XSComplexType asComplexType()
Description copied from interface:XSType
Casts this object to XSComplexType if possible, otherwise returns null.- Specified by:
asComplexType
in interfaceXSType
-
isDerivedFrom
public boolean isDerivedFrom(XSType t)
Description copied from interface:XSType
Returns true if this type is derived from the specified type.Note that t.isDerivedFrom(t) returns true.
- Specified by:
isDerivedFrom
in interfaceXSType
-
isSimpleType
public boolean isSimpleType()
Description copied from interface:XSType
Returns true ifthis instanceof XSSimpleType
.- Specified by:
isSimpleType
in interfaceXSType
-
isComplexType
public boolean isComplexType()
Description copied from interface:XSType
Returns true ifthis instanceof XSComplexType
.- Specified by:
isComplexType
in interfaceXSType
-
asEmpty
public XSContentType asEmpty()
Description copied from interface:XSContentType
If this content type represents the empty content, returnthis
, otherwise null.- Specified by:
asEmpty
in interfaceXSContentType
-
asParticle
public XSParticle asParticle()
Description copied from interface:XSContentType
Equivalent of(this instanceof XSParticle)?this:null
- Specified by:
asParticle
in interfaceXSContentType
-
getBaseType
public XSType getBaseType()
Description copied from interface:XSType
Returns the base type of this type. Note that if this type represents xs:anyType, this method returns itself. This is awkward as an API, but it follows the schema specification.- Specified by:
getBaseType
in interfaceXSType
- Returns:
- always non-null.
-
getSimpleBaseType
public XSSimpleType getSimpleBaseType()
Description copied from interface:XSSimpleType
Gets the base type as XSSimpleType. Equivalent to(XSSimpleType)getBaseType()
Since this is a simple type, we know that the base type is also a simple type. The only exception is xs:anySimpleType, which has xs:anyType as the base type.- Specified by:
getSimpleBaseType
in interfaceXSSimpleType
- Returns:
- null if this is xs:anySimpleType. Otherwise non-null.
-
getDerivationMethod
public int getDerivationMethod()
- Specified by:
getDerivationMethod
in interfaceXSType
-
iterateDeclaredFacets
public java.util.Iterator<XSFacet> iterateDeclaredFacets()
Description copied from interface:XSRestrictionSimpleType
Iterates facets that are specified in this step of derivation.- Specified by:
iterateDeclaredFacets
in interfaceXSRestrictionSimpleType
-
getDeclaredFacets
public java.util.Collection<? extends XSFacet> getDeclaredFacets()
Description copied from interface:XSRestrictionSimpleType
Gets all the facets that are declared on this restriction.- Specified by:
getDeclaredFacets
in interfaceXSRestrictionSimpleType
- Returns:
- Can be empty but always non-null.
-
visit
public void visit(XSSimpleTypeVisitor visitor)
- Specified by:
visit
in interfaceXSSimpleType
-
visit
public void visit(XSContentTypeVisitor visitor)
- Specified by:
visit
in interfaceXSContentType
-
visit
public void visit(XSVisitor visitor)
Description copied from interface:XSComponent
Accepts a visitor.- Specified by:
visit
in interfaceXSComponent
-
apply
public <T> T apply(XSSimpleTypeFunction<T> f)
- Specified by:
apply
in interfaceXSSimpleType
-
apply
public <T> T apply(XSContentTypeFunction<T> f)
- Specified by:
apply
in interfaceXSContentType
-
apply
public <T> T apply(XSFunction<T> f)
Description copied from interface:XSComponent
Accepts a functor.- Specified by:
apply
in interfaceXSComponent
-
getVariety
public XSVariety getVariety()
Description copied from interface:XSSimpleType
Gets the variety of this simple type.- Specified by:
getVariety
in interfaceXSSimpleType
-
getPrimitiveType
public XSSimpleType getPrimitiveType()
Description copied from interface:XSSimpleType
Gets the ancestor primitiveXSSimpleType
if this type isatomic
.- Specified by:
getPrimitiveType
in interfaceXSSimpleType
- Returns:
- null otherwise.
-
isPrimitive
public boolean isPrimitive()
Description copied from interface:XSSimpleType
Returns true if this is a primitive built-in simple type (that directly derives from xs:anySimpleType, by definition.)- Specified by:
isPrimitive
in interfaceXSSimpleType
-
getBaseListType
public XSListSimpleType getBaseListType()
Description copied from interface:XSSimpleType
Gets the nearest ancestorXSListSimpleType
(including itself) if the variety of this type islist
.- Specified by:
getBaseListType
in interfaceXSSimpleType
- Returns:
- otherwise return null
-
getBaseUnionType
public XSUnionSimpleType getBaseUnionType()
Description copied from interface:XSSimpleType
Gets the nearest ancestorXSUnionSimpleType
(including itself) if the variety of this type isunion
.- Specified by:
getBaseUnionType
in interfaceXSSimpleType
- Returns:
- otherwise return null
-
getFacet
public XSFacet getFacet(java.lang.String name)
Description copied from interface:XSSimpleType
Gets the effective facet object of the given name.For example, if a simple type "foo" is derived from xs:string by restriction with the "maxLength" facet and another simple type "bar" is derived from "foo" by restriction with another "maxLength" facet, this method will return the latter one, because that is the most restrictive, effective facet.
For those facets that can have multiple values (pattern facets and enumeration facets), this method will return only the first one. TODO: allow clients to access all of them by some means.
- Specified by:
getFacet
in interfaceXSSimpleType
- Returns:
- If this datatype has a facet of the given name, return that object. If the facet is not specified anywhere in its derivation chain, null will be returned.
-
getFacets
public java.util.List<XSFacet> getFacets(java.lang.String name)
Description copied from interface:XSSimpleType
For multi-valued facets (enumeration and pattern), obtain all values.- Specified by:
getFacets
in interfaceXSSimpleType
- Returns:
- can be empty but never null.
- See Also:
XSSimpleType.getFacet(String)
-
getDeclaredFacet
public XSFacet getDeclaredFacet(java.lang.String name)
Description copied from interface:XSRestrictionSimpleType
Gets the declared facet object of the given name.This method returns a facet object that is added in this type and does not recursively check the ancestors.
For those facets that can have multiple values (pattern facets and enumeration facets), this method will return only the first one.
- Specified by:
getDeclaredFacet
in interfaceXSRestrictionSimpleType
- Returns:
- Null if the facet is not specified in the last step of derivation.
-
getDeclaredFacets
public java.util.List<XSFacet> getDeclaredFacets(java.lang.String name)
Description copied from interface:XSRestrictionSimpleType
Gets the declared facets of the given name. This method is for those facets (such as 'pattern') that can be specified multiple times on a simple type.- Specified by:
getDeclaredFacets
in interfaceXSRestrictionSimpleType
- Returns:
- can be empty but never be null.
-
isRestriction
public boolean isRestriction()
Description copied from interface:XSSimpleType
Returns true ifthis instanceof XSRestrictionSimpleType
.- Specified by:
isRestriction
in interfaceXSSimpleType
-
isList
public boolean isList()
Description copied from interface:XSSimpleType
Returns true ifthis instanceof XSListSimpleType
.- Specified by:
isList
in interfaceXSSimpleType
-
isUnion
public boolean isUnion()
Description copied from interface:XSSimpleType
Returns true ifthis instanceof XSUnionSimpleType
.- Specified by:
isUnion
in interfaceXSSimpleType
-
isFinal
public boolean isFinal(XSVariety v)
Description copied from interface:XSSimpleType
Returns true if this type definition is marked as 'final' with respect to the givenXSVariety
.- Specified by:
isFinal
in interfaceXSSimpleType
- Returns:
- true if the type is marked final.
-
asRestriction
public XSRestrictionSimpleType asRestriction()
- Specified by:
asRestriction
in interfaceXSSimpleType
-
asList
public XSListSimpleType asList()
- Specified by:
asList
in interfaceXSSimpleType
-
asUnion
public XSUnionSimpleType asUnion()
- Specified by:
asUnion
in interfaceXSSimpleType
-
getType
public XSSimpleType getType()
Description copied from interface:Ref.Type
Obtains a reference as a type.- Specified by:
getType
in interfaceRef.SimpleType
- Specified by:
getType
in interfaceRef.Type
-
getRedefinedBy
public XSSimpleType getRedefinedBy()
Description copied from interface:XSSimpleType
If thisXSSimpleType
is redefined by another simple type, return that component.- Specified by:
getRedefinedBy
in interfaceXSSimpleType
- Specified by:
getRedefinedBy
in interfaceXSType
- Returns:
- null if this component has not been redefined.
-
getRedefinedCount
public int getRedefinedCount()
Description copied from interface:XSType
Returns the number of complex types that redefine this component.For example, if A is redefined by B and B is redefined by C, A.getRedefinedCount()==2, B.getRedefinedCount()==1, and C.getRedefinedCount()==0.
- Specified by:
getRedefinedCount
in interfaceXSType
-
listSubstitutables
public XSType[] listSubstitutables()
Description copied from interface:XSType
Lists up types that can substitute this type by using xsi:type. Includes this type itself.This method honors the block flag.
- Specified by:
listSubstitutables
in interfaceXSType
-
-