com.sun.xml.xsom.impl
Class SimpleTypeImpl

java.lang.Object
  extended by com.sun.xml.xsom.impl.ComponentImpl
      extended by com.sun.xml.xsom.impl.SimpleTypeImpl
All Implemented Interfaces:
ContentTypeImpl, Ref.ContentType, Ref.SimpleType, Ref.Type, XSComponent, XSContentType, XSDeclaration, XSSimpleType, XSType
Direct Known Subclasses:
ListSimpleTypeImpl, RestrictionSimpleTypeImpl, UnionSimpleTypeImpl

public abstract class SimpleTypeImpl
extends ComponentImpl
implements XSSimpleType, ContentTypeImpl, 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
 Object apply(XSContentTypeFunction function)
           
 Object apply(XSFunction function)
          Accepts a functor.
 XSComplexType asComplexType()
          Casts this object to XSComplexType if possible, otherwise returns null.
 XSContentType asEmpty()
          If this content type represents the empty content, return this, 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 ancestor XSListSimpleType (including itself) if the variety of this type is list.
 XSType getBaseType()
          Returns the base type of this type.
 XSUnionSimpleType getBaseUnionType()
          Gets the nearest ancestor XSUnionSimpleType (including itself) if the variety of this type is union.
 XSContentType getContentType()
           
 int getDerivationMethod()
           
 String getName()
          Gets the (local) name of the declaration.
 XSSimpleType getRedefinedBy()
          If this XSSimpleType 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.
 String getTargetNamespace()
          Target namespace to which this component belongs.
 XSSimpleType getType()
          Obtains a reference as a type.
 boolean isAnonymous()
          Deprecated.  
 boolean isComplexType()
          Returns true if this 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 given XSVariety.
 boolean isGlobal()
          Returns true if this declaration is a global declaration.
 boolean isList()
          Returns true if this instanceof XSListSimpleType.
 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 if this instanceof XSRestrictionSimpleType.
 boolean isSimpleType()
          Returns true if this instanceof XSSimpleType.
 boolean isUnion()
          Returns true if this instanceof XSUnionSimpleType.
 XSType[] listSubstitutables()
          Lists up types that can substitute this type by using xsi:type.
 void redefine(SimpleTypeImpl st)
           
 void visit(XSContentTypeVisitor visitor)
           
 void visit(XSVisitor visitor)
          Accepts a visitor.
 
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.XSSimpleType
apply, getFacet, getFacets, getPrimitiveType, getVariety, visit
 
Methods inherited from interface com.sun.xml.xsom.XSDeclaration
getName, getTargetNamespace, isAnonymous, isGlobal, isLocal
 
Methods inherited from interface com.sun.xml.xsom.XSComponent
getAnnotation, getAnnotation, getForeignAttribute, getForeignAttributes, getLocator, getOwnerSchema, getRoot, getSourceDocument, select, selectSingle
 

Method Detail

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 interface XSType

redefine

public void redefine(SimpleTypeImpl st)

getRedefinedBy

public XSSimpleType getRedefinedBy()
Description copied from interface: XSSimpleType
If this XSSimpleType is redefined by another simple type, return that component.

Specified by:
getRedefinedBy in interface XSSimpleType
Specified by:
getRedefinedBy in interface XSType
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 interface XSType

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 interface XSType
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 interface XSSimpleType
Returns:
null if this is xs:anySimpleType. Otherwise non-null.

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 interface XSSimpleType

getBaseListType

public XSListSimpleType getBaseListType()
Description copied from interface: XSSimpleType
Gets the nearest ancestor XSListSimpleType (including itself) if the variety of this type is list.

Specified by:
getBaseListType in interface XSSimpleType
Returns:
otherwise return null

getBaseUnionType

public XSUnionSimpleType getBaseUnionType()
Description copied from interface: XSSimpleType
Gets the nearest ancestor XSUnionSimpleType (including itself) if the variety of this type is union.

Specified by:
getBaseUnionType in interface XSSimpleType
Returns:
otherwise return null

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 given XSVariety.

Specified by:
isFinal in interface XSSimpleType
Returns:
true if the type is marked final.

getDerivationMethod

public final int getDerivationMethod()
Specified by:
getDerivationMethod in interface XSType

asSimpleType

public final XSSimpleType asSimpleType()
Description copied from interface: XSType
Casts this object to XSSimpleType if possible, otherwise returns null.

Specified by:
asSimpleType in interface XSContentType
Specified by:
asSimpleType in interface XSType

asComplexType

public final XSComplexType asComplexType()
Description copied from interface: XSType
Casts this object to XSComplexType if possible, otherwise returns null.

Specified by:
asComplexType in interface XSType

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 interface XSType

isSimpleType

public final boolean isSimpleType()
Description copied from interface: XSType
Returns true if this instanceof XSSimpleType.

Specified by:
isSimpleType in interface XSType

isComplexType

public final boolean isComplexType()
Description copied from interface: XSType
Returns true if this instanceof XSComplexType.

Specified by:
isComplexType in interface XSType

asParticle

public final XSParticle asParticle()
Description copied from interface: XSContentType
Equivalent of (this instanceof XSParticle)?this:null

Specified by:
asParticle in interface XSContentType

asEmpty

public final XSContentType asEmpty()
Description copied from interface: XSContentType
If this content type represents the empty content, return this, otherwise null.

Specified by:
asEmpty in interface XSContentType

isRestriction

public boolean isRestriction()
Description copied from interface: XSSimpleType
Returns true if this instanceof XSRestrictionSimpleType.

Specified by:
isRestriction in interface XSSimpleType

isList

public boolean isList()
Description copied from interface: XSSimpleType
Returns true if this instanceof XSListSimpleType.

Specified by:
isList in interface XSSimpleType

isUnion

public boolean isUnion()
Description copied from interface: XSSimpleType
Returns true if this instanceof XSUnionSimpleType.

Specified by:
isUnion in interface XSSimpleType

asRestriction

public XSRestrictionSimpleType asRestriction()
Specified by:
asRestriction in interface XSSimpleType

asList

public XSListSimpleType asList()
Specified by:
asList in interface XSSimpleType

asUnion

public XSUnionSimpleType asUnion()
Specified by:
asUnion in interface XSSimpleType

visit

public final void visit(XSVisitor visitor)
Description copied from interface: XSComponent
Accepts a visitor.

Specified by:
visit in interface XSComponent

visit

public final void visit(XSContentTypeVisitor visitor)
Specified by:
visit in interface XSContentType

apply

public final Object apply(XSFunction function)
Description copied from interface: XSComponent
Accepts a functor.

Specified by:
apply in interface XSComponent

apply

public final Object apply(XSContentTypeFunction function)
Specified by:
apply in interface XSContentType

getContentType

public XSContentType getContentType()
Specified by:
getContentType in interface Ref.ContentType

getType

public XSSimpleType getType()
Description copied from interface: Ref.Type
Obtains a reference as a type.

Specified by:
getType in interface Ref.SimpleType
Specified by:
getType in interface Ref.Type

getName

public String getName()
Description copied from interface: XSDeclaration
Gets the (local) name of the declaration.

Specified by:
getName in interface XSDeclaration
Returns:
null if this component is anonymous.

getTargetNamespace

public 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 interface XSDeclaration

isAnonymous

public boolean isAnonymous()
Deprecated. 

Specified by:
isAnonymous in interface XSDeclaration

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 interface XSDeclaration

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 interface XSDeclaration


Copyright © 2012 Oracle. All Rights Reserved.