Package com.sun.xml.xsom.impl
Class UnionSimpleTypeImpl
- java.lang.Object
-
- com.sun.xml.xsom.impl.ComponentImpl
-
- com.sun.xml.xsom.impl.DeclarationImpl
-
- com.sun.xml.xsom.impl.SimpleTypeImpl
-
- com.sun.xml.xsom.impl.UnionSimpleTypeImpl
-
- All Implemented Interfaces:
ContentTypeImpl
,Ref.ContentType
,Ref.SimpleType
,Ref.Type
,XSComponent
,XSContentType
,XSDeclaration
,XSSimpleType
,XSType
,XSUnionSimpleType
,java.lang.Iterable<XSSimpleType>
public class UnionSimpleTypeImpl extends SimpleTypeImpl implements XSUnionSimpleType
-
-
Field Summary
Fields Modifier and Type Field Description private Ref.SimpleType[]
memberTypes
-
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 UnionSimpleTypeImpl(SchemaDocumentImpl _parent, AnnotationImpl _annon, org.xml.sax.Locator _loc, ForeignAttributesImpl _fa, java.lang.String _name, boolean _anonymous, java.util.Set<XSVariety> finalSet, Ref.SimpleType[] _members)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
apply(XSSimpleTypeFunction function)
XSUnionSimpleType
asUnion()
XSUnionSimpleType
getBaseUnionType()
Gets the nearest ancestorXSUnionSimpleType
(including itself) if the variety of this type isunion
.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.XSSimpleType
getMember(int idx)
int
getMemberSize()
XSSimpleType
getPrimitiveType()
Gets the ancestor primitiveXSSimpleType
if this type isatomic
.XSVariety
getVariety()
Gets the variety of this simple type.boolean
isUnion()
Returns true ifthis instanceof XSUnionSimpleType
.java.util.Iterator<XSSimpleType>
iterator()
void
visit(XSSimpleTypeVisitor visitor)
-
Methods inherited from class com.sun.xml.xsom.impl.SimpleTypeImpl
apply, apply, asComplexType, asEmpty, asList, asParticle, asRestriction, asSimpleType, getBaseListType, getBaseType, getContentType, getDerivationMethod, getRedefinedBy, getRedefinedCount, getSimpleBaseType, getType, isComplexType, isDerivedFrom, isFinal, isList, isPrimitive, isRestriction, isSimpleType, listSubstitutables, redefine, visit, visit
-
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, 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, asRestriction, getBaseListType, getRedefinedBy, getSimpleBaseType, isFinal, isList, isPrimitive, isRestriction
-
Methods inherited from interface com.sun.xml.xsom.XSType
asComplexType, asSimpleType, getBaseType, getDerivationMethod, getRedefinedCount, isComplexType, isDerivedFrom, isSimpleType, listSubstitutables
-
-
-
-
Field Detail
-
memberTypes
private final Ref.SimpleType[] memberTypes
-
-
Constructor Detail
-
UnionSimpleTypeImpl
public UnionSimpleTypeImpl(SchemaDocumentImpl _parent, AnnotationImpl _annon, org.xml.sax.Locator _loc, ForeignAttributesImpl _fa, java.lang.String _name, boolean _anonymous, java.util.Set<XSVariety> finalSet, Ref.SimpleType[] _members)
-
-
Method Detail
-
getMember
public XSSimpleType getMember(int idx)
- Specified by:
getMember
in interfaceXSUnionSimpleType
-
getMemberSize
public int getMemberSize()
- Specified by:
getMemberSize
in interfaceXSUnionSimpleType
-
iterator
public java.util.Iterator<XSSimpleType> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<XSSimpleType>
-
visit
public void visit(XSSimpleTypeVisitor visitor)
- Specified by:
visit
in interfaceXSSimpleType
-
apply
public java.lang.Object apply(XSSimpleTypeFunction function)
- Specified by:
apply
in interfaceXSSimpleType
-
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
- Overrides:
getBaseUnionType
in classSimpleTypeImpl
- 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)
-
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.
-
isUnion
public boolean isUnion()
Description copied from interface:XSSimpleType
Returns true ifthis instanceof XSUnionSimpleType
.- Specified by:
isUnion
in interfaceXSSimpleType
- Overrides:
isUnion
in classSimpleTypeImpl
-
asUnion
public XSUnionSimpleType asUnion()
- Specified by:
asUnion
in interfaceXSSimpleType
- Overrides:
asUnion
in classSimpleTypeImpl
-
-