- java.lang.Object
-
- com.sun.xml.xsom.impl.ComponentImpl
-
- com.sun.xml.xsom.impl.SchemaSetImpl.AnySimpleType
-
- All Implemented Interfaces:
Ref.SimpleType,Ref.Type,XSComponent,XSContentType,XSDeclaration,XSRestrictionSimpleType,XSSimpleType,XSType
- Enclosing class:
- SchemaSetImpl
public class SchemaSetImpl.AnySimpleType extends ComponentImpl 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> Tapply(XSContentTypeFunction<T> f)<T> Tapply(XSFunction<T> f)Accepts a functor.<T> Tapply(XSSimpleTypeFunction<T> f)XSComplexTypeasComplexType()Casts this object to XSComplexType if possible, otherwise returns null.XSContentTypeasEmpty()If this content type represents the empty content, returnthis, otherwise null.XSListSimpleTypeasList()XSParticleasParticle()Equivalent of(this instanceof XSParticle)?this:nullXSRestrictionSimpleTypeasRestriction()XSSimpleTypeasSimpleType()Casts this object to XSSimpleType if possible, otherwise returns null.XSUnionSimpleTypeasUnion()XSListSimpleTypegetBaseListType()Gets the nearest ancestorXSListSimpleType(including itself) if the variety of this type islist.XSTypegetBaseType()Returns the base type of this type.XSUnionSimpleTypegetBaseUnionType()Gets the nearest ancestorXSUnionSimpleType(including itself) if the variety of this type isunion.XSFacetgetDeclaredFacet(String name)Gets the declared facet object of the given name.Collection<? extends XSFacet>getDeclaredFacets()Gets all the facets that are declared on this restriction.List<XSFacet>getDeclaredFacets(String name)Gets the declared facets of the given name.intgetDerivationMethod()XSFacetgetFacet(String name)Gets the effective facet object of the given name.List<XSFacet>getFacets(String name)For multi-valued facets (enumeration and pattern), obtain all values.StringgetName()Gets the (local) name of the declaration.SchemaImplgetOwnerSchema()Gets a reference to theXSSchemaobject to which this component belongs.XSSimpleTypegetPrimitiveType()Gets the ancestor primitive if this type isatomic.XSSimpleTypegetRedefinedBy()If this is redefined by another simple type, return that component.intgetRedefinedCount()Returns the number of complex types that redefine this component.XSSimpleTypegetSimpleBaseType()Gets the base type as XSSimpleType.StringgetTargetNamespace()Target namespace to which this component belongs.XSSimpleTypegetType()Obtains a reference as a type.XSVarietygetVariety()Gets the variety of this simple type.booleanisAnonymous()Deprecated.booleanisComplexType()Returns true ifthis instanceof XSComplexType.booleanisDerivedFrom(XSType t)Returns true if this type is derived from the specified type.booleanisFinal(XSVariety v)Returns true if this type definition is marked as 'final' with respect to the givenXSVariety.booleanisGlobal()Returns true if this declaration is a global declaration.booleanisList()Returns true ifthis instanceof XSListSimpleType.booleanisLocal()Returns true if this declaration is a local declaration.booleanisPrimitive()Returns true if this is a primitive built-in simple type (that directly derives from xs:anySimpleType, by definition.)booleanisRestriction()Returns true ifthis instanceof XSRestrictionSimpleType.booleanisSimpleType()Returns true ifthis instanceof XSSimpleType.booleanisUnion()Returns true ifthis instanceof XSUnionSimpleType.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.voidvisit(XSContentTypeVisitor visitor)voidvisit(XSSimpleTypeVisitor visitor)voidvisit(XSVisitor visitor)Accepts a visitor.-
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:XSComponentGets a reference to theXSSchemaobject to which this component belongs.In case of
XSEmptycomponent, this method returns null since there is no owner component.- Specified by:
getOwnerSchemain interfaceXSComponent- Overrides:
getOwnerSchemain classComponentImpl
-
asSimpleType
public XSSimpleType asSimpleType()
Description copied from interface:XSTypeCasts this object to XSSimpleType if possible, otherwise returns null.- Specified by:
asSimpleTypein interfaceXSContentType- Specified by:
asSimpleTypein interfaceXSType
-
asComplexType
public XSComplexType asComplexType()
Description copied from interface:XSTypeCasts this object to XSComplexType if possible, otherwise returns null.- Specified by:
asComplexTypein interfaceXSType
-
isDerivedFrom
public boolean isDerivedFrom(XSType t)
Description copied from interface:XSTypeReturns true if this type is derived from the specified type.Note that
t.isDerivedFrom(t)returns true.- Specified by:
isDerivedFromin interfaceXSType
-
isSimpleType
public boolean isSimpleType()
Description copied from interface:XSTypeReturns true ifthis instanceof XSSimpleType.- Specified by:
isSimpleTypein interfaceXSType
-
isComplexType
public boolean isComplexType()
Description copied from interface:XSTypeReturns true ifthis instanceof XSComplexType.- Specified by:
isComplexTypein interfaceXSType
-
asEmpty
public XSContentType asEmpty()
Description copied from interface:XSContentTypeIf this content type represents the empty content, returnthis, otherwise null.- Specified by:
asEmptyin interfaceXSContentType
-
asParticle
public XSParticle asParticle()
Description copied from interface:XSContentTypeEquivalent of(this instanceof XSParticle)?this:null- Specified by:
asParticlein interfaceXSContentType
-
getBaseType
public XSType getBaseType()
Description copied from interface:XSTypeReturns the base type of this type. Note that if this type representsxs:anyType, this method returns itself. This is awkward as an API, but it follows the schema specification.- Specified by:
getBaseTypein interfaceXSType- Returns:
- always non-null.
-
getSimpleBaseType
public XSSimpleType getSimpleBaseType()
Description copied from interface:XSSimpleTypeGets 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:
getSimpleBaseTypein interfaceXSSimpleType- Returns:
- null if this is xs:anySimpleType. Otherwise non-null.
-
getDerivationMethod
public int getDerivationMethod()
- Specified by:
getDerivationMethodin interfaceXSType
-
iterateDeclaredFacets
public Iterator<XSFacet> iterateDeclaredFacets()
Description copied from interface:XSRestrictionSimpleTypeIterates facets that are specified in this step of derivation.- Specified by:
iterateDeclaredFacetsin interfaceXSRestrictionSimpleType
-
getDeclaredFacets
public Collection<? extends XSFacet> getDeclaredFacets()
Description copied from interface:XSRestrictionSimpleTypeGets all the facets that are declared on this restriction.- Specified by:
getDeclaredFacetsin interfaceXSRestrictionSimpleType- Returns:
- Can be empty but always non-null.
-
visit
public void visit(XSSimpleTypeVisitor visitor)
- Specified by:
visitin interfaceXSSimpleType
-
visit
public void visit(XSContentTypeVisitor visitor)
- Specified by:
visitin interfaceXSContentType
-
visit
public void visit(XSVisitor visitor)
Description copied from interface:XSComponentAccepts a visitor.- Specified by:
visitin interfaceXSComponent
-
apply
public <T> T apply(XSSimpleTypeFunction<T> f)
- Specified by:
applyin interfaceXSSimpleType
-
apply
public <T> T apply(XSContentTypeFunction<T> f)
- Specified by:
applyin interfaceXSContentType
-
apply
public <T> T apply(XSFunction<T> f)
Description copied from interface:XSComponentAccepts a functor.- Specified by:
applyin interfaceXSComponent
-
getVariety
public XSVariety getVariety()
Description copied from interface:XSSimpleTypeGets the variety of this simple type.- Specified by:
getVarietyin interfaceXSSimpleType
-
getPrimitiveType
public XSSimpleType getPrimitiveType()
Description copied from interface:XSSimpleTypeGets the ancestor primitive if this type isatomic.- Specified by:
getPrimitiveTypein interfaceXSSimpleType- Returns:
- null otherwise.
-
isPrimitive
public boolean isPrimitive()
Description copied from interface:XSSimpleTypeReturns true if this is a primitive built-in simple type (that directly derives from xs:anySimpleType, by definition.)- Specified by:
isPrimitivein interfaceXSSimpleType
-
getBaseListType
public XSListSimpleType getBaseListType()
Description copied from interface:XSSimpleTypeGets the nearest ancestorXSListSimpleType(including itself) if the variety of this type islist.- Specified by:
getBaseListTypein interfaceXSSimpleType- Returns:
- otherwise return null
-
getBaseUnionType
public XSUnionSimpleType getBaseUnionType()
Description copied from interface:XSSimpleTypeGets the nearest ancestorXSUnionSimpleType(including itself) if the variety of this type isunion.- Specified by:
getBaseUnionTypein interfaceXSSimpleType- Returns:
- otherwise return null
-
getFacet
public XSFacet getFacet(String name)
Description copied from interface:XSSimpleTypeGets 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:
getFacetin 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 List<XSFacet> getFacets(String name)
Description copied from interface:XSSimpleTypeFor multi-valued facets (enumeration and pattern), obtain all values.- Specified by:
getFacetsin interfaceXSSimpleType- Returns:
- can be empty but never null.
- See Also:
XSSimpleType.getFacet(String)
-
getDeclaredFacet
public XSFacet getDeclaredFacet(String name)
Description copied from interface:XSRestrictionSimpleTypeGets 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:
getDeclaredFacetin interfaceXSRestrictionSimpleType- Returns:
- Null if the facet is not specified in the last step of derivation.
-
getDeclaredFacets
public List<XSFacet> getDeclaredFacets(String name)
Description copied from interface:XSRestrictionSimpleTypeGets 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:
getDeclaredFacetsin interfaceXSRestrictionSimpleType- Returns:
- can be empty but never be null.
-
isRestriction
public boolean isRestriction()
Description copied from interface:XSSimpleTypeReturns true ifthis instanceof XSRestrictionSimpleType.- Specified by:
isRestrictionin interfaceXSSimpleType
-
isList
public boolean isList()
Description copied from interface:XSSimpleTypeReturns true ifthis instanceof XSListSimpleType.- Specified by:
isListin interfaceXSSimpleType
-
isUnion
public boolean isUnion()
Description copied from interface:XSSimpleTypeReturns true ifthis instanceof XSUnionSimpleType.- Specified by:
isUnionin interfaceXSSimpleType
-
isFinal
public boolean isFinal(XSVariety v)
Description copied from interface:XSSimpleTypeReturns true if this type definition is marked as 'final' with respect to the givenXSVariety.- Specified by:
isFinalin interfaceXSSimpleType- Returns:
- true if the type is marked final.
-
asRestriction
public XSRestrictionSimpleType asRestriction()
- Specified by:
asRestrictionin interfaceXSSimpleType
-
asList
public XSListSimpleType asList()
- Specified by:
asListin interfaceXSSimpleType
-
asUnion
public XSUnionSimpleType asUnion()
- Specified by:
asUnionin interfaceXSSimpleType
-
getType
public XSSimpleType getType()
Description copied from interface:Ref.TypeObtains a reference as a type.- Specified by:
getTypein interfaceRef.SimpleType- Specified by:
getTypein interfaceRef.Type
-
getRedefinedBy
public XSSimpleType getRedefinedBy()
Description copied from interface:XSSimpleTypeIf this is redefined by another simple type, return that component.- Specified by:
getRedefinedByin interfaceXSSimpleType- Specified by:
getRedefinedByin interfaceXSType- Returns:
- null if this component has not been redefined.
-
getRedefinedCount
public int getRedefinedCount()
Description copied from interface:XSTypeReturns 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:
getRedefinedCountin interfaceXSType
-
listSubstitutables
public XSType[] listSubstitutables()
Description copied from interface:XSTypeLists up types that can substitute this type by using xsi:type. Includes this type itself.This method honors the block flag.
- Specified by:
listSubstitutablesin interfaceXSType
-
getName
public String getName()
Description copied from interface:XSDeclarationGets the (local) name of the declaration.- Specified by:
getNamein interfaceXSDeclaration- Returns:
- null if this component is anonymous.
-
getTargetNamespace
public String getTargetNamespace()
Description copied from interface:XSDeclarationTarget namespace to which this component belongs.""is used to represent the default no namespace.- Specified by:
getTargetNamespacein interfaceXSDeclaration
-
isAnonymous
@Deprecated public boolean isAnonymous()
Deprecated.- Specified by:
isAnonymousin interfaceXSDeclaration
-
isGlobal
public final boolean isGlobal()
Description copied from interface:XSDeclarationReturns true if this declaration is a global declaration. Global declarations are those declaration that can be enumerated through the schema object.- Specified by:
isGlobalin interfaceXSDeclaration
-
isLocal
public final boolean isLocal()
Description copied from interface:XSDeclarationReturns true if this declaration is a local declaration. Equivalent of!isGlobal()- Specified by:
isLocalin interfaceXSDeclaration
-
-