Package com.sun.xml.xsom
Interface XSSimpleType
-
- All Superinterfaces:
XSComponent
,XSContentType
,XSDeclaration
,XSType
- All Known Subinterfaces:
XSListSimpleType
,XSRestrictionSimpleType
,XSUnionSimpleType
- All Known Implementing Classes:
ListSimpleTypeImpl
,RestrictionSimpleTypeImpl
,SimpleTypeImpl
,UnionSimpleTypeImpl
public interface XSSimpleType extends XSType, XSContentType
Simple type.- Author:
- Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
-
-
Field Summary
-
Fields inherited from interface com.sun.xml.xsom.XSType
EXTENSION, RESTRICTION, SUBSTITUTION
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
apply(XSSimpleTypeFunction<T> function)
XSListSimpleType
asList()
XSRestrictionSimpleType
asRestriction()
XSUnionSimpleType
asUnion()
XSListSimpleType
getBaseListType()
Gets the nearest ancestorXSListSimpleType
(including itself) if the variety of this type islist
.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
getPrimitiveType()
Gets the ancestor primitiveXSSimpleType
if this type isatomic
.XSSimpleType
getRedefinedBy()
If thisXSSimpleType
is redefined by another simple type, return that component.XSSimpleType
getSimpleBaseType()
Gets the base type as XSSimpleType.XSVariety
getVariety()
Gets the variety of this simple 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
isUnion()
Returns true ifthis instanceof XSUnionSimpleType
.void
visit(XSSimpleTypeVisitor visitor)
-
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.XSType
asComplexType, asSimpleType, getBaseType, getDerivationMethod, getRedefinedCount, isComplexType, isDerivedFrom, isSimpleType, listSubstitutables
-
-
-
-
Method Detail
-
getSimpleBaseType
XSSimpleType getSimpleBaseType()
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.- Returns:
- null if this is xs:anySimpleType. Otherwise non-null.
-
getVariety
XSVariety getVariety()
Gets the variety of this simple type.
-
getPrimitiveType
XSSimpleType getPrimitiveType()
Gets the ancestor primitiveXSSimpleType
if this type isatomic
.- Returns:
- null otherwise.
-
isPrimitive
boolean isPrimitive()
Returns true if this is a primitive built-in simple type (that directly derives from xs:anySimpleType, by definition.)
-
getBaseListType
XSListSimpleType getBaseListType()
Gets the nearest ancestorXSListSimpleType
(including itself) if the variety of this type islist
.- Returns:
- otherwise return null
-
getBaseUnionType
XSUnionSimpleType getBaseUnionType()
Gets the nearest ancestorXSUnionSimpleType
(including itself) if the variety of this type isunion
.- Returns:
- otherwise return null
-
isFinal
boolean isFinal(XSVariety v)
Returns true if this type definition is marked as 'final' with respect to the givenXSVariety
.- Returns:
- true if the type is marked final.
-
getRedefinedBy
XSSimpleType getRedefinedBy()
If thisXSSimpleType
is redefined by another simple type, return that component.- Specified by:
getRedefinedBy
in interfaceXSType
- Returns:
- null if this component has not been redefined.
-
getFacet
XSFacet getFacet(java.lang.String name)
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.
- 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
java.util.List<XSFacet> getFacets(java.lang.String name)
For multi-valued facets (enumeration and pattern), obtain all values.- Returns:
- can be empty but never null.
- See Also:
getFacet(String)
-
visit
void visit(XSSimpleTypeVisitor visitor)
-
apply
<T> T apply(XSSimpleTypeFunction<T> function)
-
isRestriction
boolean isRestriction()
Returns true ifthis instanceof XSRestrictionSimpleType
.
-
isList
boolean isList()
Returns true ifthis instanceof XSListSimpleType
.
-
isUnion
boolean isUnion()
Returns true ifthis instanceof XSUnionSimpleType
.
-
asRestriction
XSRestrictionSimpleType asRestriction()
-
asList
XSListSimpleType asList()
-
asUnion
XSUnionSimpleType asUnion()
-
-