XSOM 20110809-redhat-3

com.sun.xml.xsom.impl
Class ComplexTypeImpl

java.lang.Object
  extended by com.sun.xml.xsom.impl.ComponentImpl
      extended by com.sun.xml.xsom.impl.AttributesHolder
          extended by com.sun.xml.xsom.impl.ComplexTypeImpl
All Implemented Interfaces:
Ref.ComplexType, Ref.Type, XSAttContainer, XSComplexType, XSComponent, XSDeclaration, XSType

public class ComplexTypeImpl
extends AttributesHolder
implements XSComplexType, Ref.ComplexType


Field Summary
 
Fields inherited from class com.sun.xml.xsom.impl.AttributesHolder
attGroups, attributes, prohibitedAtts
 
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
ComplexTypeImpl(SchemaDocumentImpl _parent, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa, String _name, boolean _anonymous, boolean _abstract, int _derivationMethod, Ref.Type _base, int _final, int _block, boolean _mixed)
           
 
Method Summary
<T> T
apply(XSFunction<T> function)
          Accepts a functor.
 XSComplexType asComplexType()
          Casts this object to XSComplexType if possible, otherwise returns null.
 XSSimpleType asSimpleType()
          Casts this object to XSSimpleType if possible, otherwise returns null.
 XSAttributeUse getAttributeUse(String nsURI, String localName)
          Looks for the attribute use with the specified name from all the attribute uses that are directly/indirectly referenced from this component.
 Collection<XSAttributeUse> getAttributeUses()
          Returns the attribute uses by looking at attribute groups and etc.
 XSWildcard getAttributeWildcard()
           
 XSType getBaseType()
          Returns the base type of this type.
 XSContentType getContentType()
          The content of this complex type.
 int getDerivationMethod()
           
 List<XSElementDecl> getElementDecls()
          Returns a list of element declarations of this type.
 XSContentType getExplicitContent()
          Gets the explicit content of a complex type with a complex content that was derived by extension.
 String getName()
          Gets the (local) name of the declaration.
 XSComplexType getRedefinedBy()
          If this XSComplexType is redefined by another complex type, return that component.
 int getRedefinedCount()
          Returns the number of complex types that redefine this component.
 XSElementDecl getScope()
          Gets the scope of this complex type.
 List<XSComplexType> getSubtypes()
          Returns a list of direct subtypes of this complex type.
 String getTargetNamespace()
          Target namespace to which this component belongs.
 XSComplexType getType()
          Obtains a reference as a type.
 boolean isAbstract()
          Checks if this complex type is declared as an abstract 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(int derivationMethod)
           
 boolean isGlobal()
          Returns true if this declaration is a global declaration.
 boolean isLocal()
          Returns true if this declaration is a local declaration.
 boolean isMixed()
           
 boolean isSimpleType()
          Returns true if this instanceof XSSimpleType.
 boolean isSubstitutionProhibited(int method)
          Roughly corresponds to the block attribute.
 Iterator<XSAttributeUse> iterateAttributeUses()
          Lists all the attribute uses that are directly/indirectly referenced from this component.
 XSType[] listSubstitutables()
          Lists up types that can substitute this type by using xsi:type.
 void redefine(ComplexTypeImpl ct)
          Called when this complex type redefines the specified complex type.
 void setContentType(Ref.ContentType v)
           
 void setExplicitContent(XSContentType v)
           
 void setScope(XSElementDecl _scope)
           
 void setWildcard(WildcardImpl wc)
          Set the local attribute wildcard.
 void visit(XSVisitor visitor)
          Accepts a visitor.
 
Methods inherited from class com.sun.xml.xsom.impl.AttributesHolder
addAttGroup, addAttributeUse, addProhibitedAttribute, getAttGroups, getDeclaredAttributeUse, getDeclaredAttributeUses, iterateAttGroups, iterateDeclaredAttributeUses
 
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.XSAttContainer
getAttGroups, getDeclaredAttributeUse, getDeclaredAttributeUses, iterateAttGroups, iterateDeclaredAttributeUses
 
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
 

Constructor Detail

ComplexTypeImpl

public ComplexTypeImpl(SchemaDocumentImpl _parent,
                       AnnotationImpl _annon,
                       Locator _loc,
                       ForeignAttributesImpl _fa,
                       String _name,
                       boolean _anonymous,
                       boolean _abstract,
                       int _derivationMethod,
                       Ref.Type _base,
                       int _final,
                       int _block,
                       boolean _mixed)
Method Detail

asComplexType

public 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

asSimpleType

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

Specified by:
asSimpleType 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

getDerivationMethod

public int getDerivationMethod()
Specified by:
getDerivationMethod 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.

redefine

public void redefine(ComplexTypeImpl ct)
Called when this complex type redefines the specified complex type.


getRedefinedBy

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

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

getScope

public XSElementDecl getScope()
Description copied from interface: XSComplexType
Gets the scope of this complex type. This is not a property defined in the schema spec.

Specified by:
getScope in interface XSComplexType
Returns:
null if this complex type is global. Otherwise return the element declaration that contains this anonymous complex type.

setScope

public void setScope(XSElementDecl _scope)

isAbstract

public boolean isAbstract()
Description copied from interface: XSComplexType
Checks if this complex type is declared as an abstract type.

Specified by:
isAbstract in interface XSComplexType

setWildcard

public void setWildcard(WildcardImpl wc)
Set the local attribute wildcard.

Specified by:
setWildcard in class AttributesHolder

getAttributeWildcard

public XSWildcard getAttributeWildcard()
Specified by:
getAttributeWildcard in interface XSAttContainer

isFinal

public boolean isFinal(int derivationMethod)
Specified by:
isFinal in interface XSComplexType

isSubstitutionProhibited

public boolean isSubstitutionProhibited(int method)
Description copied from interface: XSComplexType
Roughly corresponds to the block attribute. But see the spec for gory detail.

Specified by:
isSubstitutionProhibited in interface XSComplexType

setContentType

public void setContentType(Ref.ContentType v)

getContentType

public XSContentType getContentType()
Description copied from interface: XSComplexType
The content of this complex type.

Specified by:
getContentType in interface XSComplexType
Returns:
always non-null.

setExplicitContent

public void setExplicitContent(XSContentType v)

getExplicitContent

public XSContentType getExplicitContent()
Description copied from interface: XSComplexType
Gets the explicit content of a complex type with a complex content that was derived by extension.

Informally, the "explicit content" is the portion of the content model added in this derivation. IOW, it's a delta between the base complex type and this complex type.

For example, when a complex type T2 derives fom T1, then:

 content type of T2 = SEQUENCE( content type of T1, explicit content of T2 )
 

Specified by:
getExplicitContent in interface XSComplexType
Returns:
If this complex type is derived by restriction or has a simple content, this method returns null. IOW, this method only works for a complex type with a complex content derived by extension from another complex type.

isMixed

public boolean isMixed()
Specified by:
isMixed in interface XSComplexType

getAttributeUse

public XSAttributeUse getAttributeUse(String nsURI,
                                      String localName)
Description copied from interface: XSAttContainer
Looks for the attribute use with the specified name from all the attribute uses that are directly/indirectly referenced from this component.

This is the exact implementation of the "attribute use" schema component.

Specified by:
getAttributeUse in interface XSAttContainer

iterateAttributeUses

public Iterator<XSAttributeUse> iterateAttributeUses()
Description copied from interface: XSAttContainer
Lists all the attribute uses that are directly/indirectly referenced from this component.

This is the exact implementation of the "attribute use" schema component.

Specified by:
iterateAttributeUses in interface XSAttContainer
Overrides:
iterateAttributeUses in class AttributesHolder

getAttributeUses

public Collection<XSAttributeUse> getAttributeUses()
Description copied from class: AttributesHolder
Returns the attribute uses by looking at attribute groups and etc. Searching for the base type is done in ComplexTypeImpl.

Specified by:
getAttributeUses in interface XSAttContainer
Overrides:
getAttributeUses in class AttributesHolder

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

visit

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

Specified by:
visit in interface XSComponent

apply

public <T> T apply(XSFunction<T> function)
Description copied from interface: XSComponent
Accepts a functor.

Specified by:
apply in interface XSComponent

getType

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

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

getSubtypes

public List<XSComplexType> getSubtypes()
Description copied from interface: XSComplexType
Returns a list of direct subtypes of this complex type. If the type is not subtyped, returns empty list. Doesn't return null. Note that the complex type may be extended outside of the scope of the schemaset known to XSOM.

Specified by:
getSubtypes in interface XSComplexType
Returns:

getElementDecls

public List<XSElementDecl> getElementDecls()
Description copied from interface: XSComplexType
Returns a list of element declarations of this type.

Specified by:
getElementDecls in interface XSComplexType
Returns:

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

XSOM 20110809-redhat-3

Copyright © 2012 Oracle. All Rights Reserved.