Class RestrictionSimpleTypeImpl
- java.lang.Object
-
- com.sun.xml.xsom.impl.ComponentImpl
-
- com.sun.xml.xsom.impl.SimpleTypeImpl
-
- com.sun.xml.xsom.impl.RestrictionSimpleTypeImpl
-
- All Implemented Interfaces:
ContentTypeImpl
,Ref.ContentType
,Ref.SimpleType
,Ref.Type
,XSComponent
,XSContentType
,XSDeclaration
,XSRestrictionSimpleType
,XSSimpleType
,XSType
public class RestrictionSimpleTypeImpl extends SimpleTypeImpl implements XSRestrictionSimpleType
-
-
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 RestrictionSimpleTypeImpl(SchemaDocumentImpl _parent, AnnotationImpl _annon, org.xml.sax.Locator _loc, ForeignAttributesImpl _fa, java.lang.String _name, boolean _anonymous, java.util.Set<XSVariety> finalSet, Ref.SimpleType _baseType)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addFacet(XSFacet facet)
java.lang.Object
apply(XSSimpleTypeFunction function)
XSRestrictionSimpleType
asRestriction()
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.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.java.lang.String
getName()
Gets the (local) name of the declaration.XSSimpleType
getPrimitiveType()
Gets the ancestor primitiveXSSimpleType
if this type isatomic
.java.lang.String
getTargetNamespace()
Target namespace to which this component belongs.XSVariety
getVariety()
Gets the variety of this simple type.boolean
isAnonymous()
Deprecated.boolean
isGlobal()
Returns true if this declaration is a global declaration.boolean
isLocal()
Returns true if this declaration is a local declaration.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
.java.util.Iterator<XSFacet>
iterateDeclaredFacets()
Iterates facets that are specified in this step of derivation.void
visit(XSSimpleTypeVisitor visitor)
-
Methods inherited from class com.sun.xml.xsom.impl.SimpleTypeImpl
apply, apply, asComplexType, asEmpty, asList, asParticle, asSimpleType, asUnion, getBaseListType, getBaseType, getBaseUnionType, getContentType, getDerivationMethod, getRedefinedBy, getRedefinedCount, getSimpleBaseType, getType, isComplexType, isDerivedFrom, isFinal, isList, isSimpleType, isUnion, listSubstitutables, redefine, visit, visit
-
Methods inherited from class com.sun.xml.xsom.impl.ComponentImpl
getAnnotation, getAnnotation, getForeignAttribute, getForeignAttributes, getLocator, getOwnerSchema, 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
apply, getAnnotation, getAnnotation, getForeignAttribute, getForeignAttributes, getLocator, getOwnerSchema, getRoot, getSourceDocument, select, selectSingle, visit
-
Methods inherited from interface com.sun.xml.xsom.XSContentType
apply, asEmpty, asParticle, asSimpleType, visit
-
Methods inherited from interface com.sun.xml.xsom.XSDeclaration
getName, getTargetNamespace, isAnonymous, isGlobal, isLocal
-
Methods inherited from interface com.sun.xml.xsom.XSSimpleType
asList, asUnion, getBaseListType, getBaseUnionType, getRedefinedBy, getSimpleBaseType, isFinal, isList, isUnion
-
Methods inherited from interface com.sun.xml.xsom.XSType
asComplexType, asSimpleType, getBaseType, getDerivationMethod, getRedefinedCount, isComplexType, isDerivedFrom, isSimpleType, listSubstitutables
-
-
-
-
Constructor Detail
-
RestrictionSimpleTypeImpl
public RestrictionSimpleTypeImpl(SchemaDocumentImpl _parent, AnnotationImpl _annon, org.xml.sax.Locator _loc, ForeignAttributesImpl _fa, java.lang.String _name, boolean _anonymous, java.util.Set<XSVariety> finalSet, Ref.SimpleType _baseType)
-
-
Method Detail
-
addFacet
public void addFacet(XSFacet facet)
-
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.
-
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.
-
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)
-
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
- Overrides:
isPrimitive
in classSimpleTypeImpl
-
visit
public void visit(XSSimpleTypeVisitor visitor)
- Specified by:
visit
in interfaceXSSimpleType
-
apply
public java.lang.Object apply(XSSimpleTypeFunction function)
- Specified by:
apply
in interfaceXSSimpleType
-
isRestriction
public boolean isRestriction()
Description copied from interface:XSSimpleType
Returns true ifthis instanceof XSRestrictionSimpleType
.- Specified by:
isRestriction
in interfaceXSSimpleType
- Overrides:
isRestriction
in classSimpleTypeImpl
-
asRestriction
public XSRestrictionSimpleType asRestriction()
- Specified by:
asRestriction
in interfaceXSSimpleType
- Overrides:
asRestriction
in classSimpleTypeImpl
-
getName
public java.lang.String getName()
Description copied from interface:XSDeclaration
Gets the (local) name of the declaration.- Specified by:
getName
in interfaceXSDeclaration
- Returns:
- null if this component is anonymous.
-
getTargetNamespace
public java.lang.String getTargetNamespace()
Description copied from interface:XSDeclaration
Target namespace to which this component belongs.""
is used to represent the default no namespace.- Specified by:
getTargetNamespace
in interfaceXSDeclaration
-
isAnonymous
public boolean isAnonymous()
Deprecated.- Specified by:
isAnonymous
in interfaceXSDeclaration
-
isGlobal
public final boolean isGlobal()
Description copied from interface:XSDeclaration
Returns true if this declaration is a global declaration. Global declarations are those declaration that can be enumerated through the schema object.- Specified by:
isGlobal
in interfaceXSDeclaration
-
isLocal
public final boolean isLocal()
Description copied from interface:XSDeclaration
Returns true if this declaration is a local declaration. Equivalent of!isGlobal()
- Specified by:
isLocal
in interfaceXSDeclaration
-
-