Package com.sun.xml.xsom.impl
Class ComponentImpl
- java.lang.Object
-
- com.sun.xml.xsom.impl.ComponentImpl
-
- All Implemented Interfaces:
XSComponent
- Direct Known Subclasses:
AttributeDeclImpl
,AttributesHolder
,AttributeUseImpl
,ElementDecl
,EmptyImpl
,FacetImpl
,IdentityConstraintImpl
,ModelGroupDeclImpl
,ModelGroupImpl
,NotationImpl
,ParticleImpl
,SimpleTypeImpl
,WildcardImpl
,XPathImpl
public abstract class ComponentImpl extends java.lang.Object implements XSComponent
-
-
Field Summary
Fields Modifier and Type Field Description protected SchemaDocumentImpl
ownerDocument
-
Constructor Summary
Constructors Modifier Constructor Description protected
ComponentImpl(SchemaDocumentImpl _owner, AnnotationImpl _annon, org.xml.sax.Locator _loc, ForeignAttributesImpl fa)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XSAnnotation
getAnnotation()
Gets the annotation associated to this component, if any.XSAnnotation
getAnnotation(boolean createIfNotExist)
Works likeXSComponent.getAnnotation()
, but allow a new emptyXSAnnotation
to be created if not exist.java.lang.String
getForeignAttribute(java.lang.String nsUri, java.lang.String localName)
Gets the foreign attribute of the given name, or null if not found.java.util.List<ForeignAttributesImpl>
getForeignAttributes()
Gets the foreign attributes on this schema component.org.xml.sax.Locator
getLocator()
Gets the locator that indicates the source location where this component is created from, or null if no information is available.SchemaImpl
getOwnerSchema()
Gets a reference to theXSSchema
object to which this component belongs.XSSchemaSet
getRoot()
Gets the root schema set that includes this component.SchemaDocument
getSourceDocument()
Gets theSchemaDocument
that indicates which document this component was defined in.java.util.Collection<XSComponent>
select(java.lang.String scd, javax.xml.namespace.NamespaceContext nsContext)
Evaluates a schema component designator against this schema component and returns the resulting schema components.XSComponent
selectSingle(java.lang.String scd, javax.xml.namespace.NamespaceContext nsContext)
Evaluates a schema component designator against this schema component and returns the first resulting schema component.java.lang.String
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, visit
-
-
-
-
Field Detail
-
ownerDocument
protected final SchemaDocumentImpl ownerDocument
-
-
Constructor Detail
-
ComponentImpl
protected ComponentImpl(SchemaDocumentImpl _owner, AnnotationImpl _annon, org.xml.sax.Locator _loc, ForeignAttributesImpl fa)
-
-
Method Detail
-
getOwnerSchema
public SchemaImpl getOwnerSchema()
Description copied from interface:XSComponent
Gets a reference to theXSSchema
object to which this component belongs.In case of
XSEmpty
component, this method returns null since there is no owner component.- Specified by:
getOwnerSchema
in interfaceXSComponent
-
getRoot
public XSSchemaSet getRoot()
Description copied from interface:XSComponent
Gets the root schema set that includes this component.In case of
XSEmpty
component, this method returns null since there is no owner component.- Specified by:
getRoot
in interfaceXSComponent
-
getSourceDocument
public SchemaDocument getSourceDocument()
Description copied from interface:XSComponent
Gets theSchemaDocument
that indicates which document this component was defined in.- Specified by:
getSourceDocument
in interfaceXSComponent
- Returns:
- null for components that are built-in to XML Schema, such
as anyType, or "empty"
XSContentType
. This method also returns null forXSSchema
. For all other user-defined components this method returns non-null, even if they are local.
-
getAnnotation
public final XSAnnotation getAnnotation()
Description copied from interface:XSComponent
Gets the annotation associated to this component, if any.- Specified by:
getAnnotation
in interfaceXSComponent
-
getAnnotation
public XSAnnotation getAnnotation(boolean createIfNotExist)
Description copied from interface:XSComponent
Works likeXSComponent.getAnnotation()
, but allow a new emptyXSAnnotation
to be created if not exist.- Specified by:
getAnnotation
in interfaceXSComponent
- Parameters:
createIfNotExist
- true to create a newXSAnnotation
if it doesn't exist already. false to make this method behavel likeXSComponent.getAnnotation()
.- Returns:
- null if
createIfNotExist==false
and annotation didn't exist. Otherwise non-null.
-
getLocator
public final org.xml.sax.Locator getLocator()
Description copied from interface:XSComponent
Gets the locator that indicates the source location where this component is created from, or null if no information is available.- Specified by:
getLocator
in interfaceXSComponent
-
getForeignAttributes
public java.util.List<ForeignAttributesImpl> getForeignAttributes()
Description copied from interface:XSComponent
Gets the foreign attributes on this schema component.In general, a schema component may match multiple elements in a schema document, and those elements can individually carry foreign attributes.
This method returns a list of
ForeignAttributes
, where eachForeignAttributes
object represent foreign attributes on one element.- Specified by:
getForeignAttributes
in interfaceXSComponent
- Returns:
- can be an empty list but never be null.
-
getForeignAttribute
public java.lang.String getForeignAttribute(java.lang.String nsUri, java.lang.String localName)
Description copied from interface:XSComponent
Gets the foreign attribute of the given name, or null if not found.If multiple occurences of the same attribute is found, this method returns the first one.
- Specified by:
getForeignAttribute
in interfaceXSComponent
- See Also:
XSComponent.getForeignAttributes()
-
select
public java.util.Collection<XSComponent> select(java.lang.String scd, javax.xml.namespace.NamespaceContext nsContext)
Description copied from interface:XSComponent
Evaluates a schema component designator against this schema component and returns the resulting schema components.- Specified by:
select
in interfaceXSComponent
- Parameters:
scd
- Schema component designator. SeeSCD
for more details.nsContext
- The namespace context in which SCD is evaluated. Cannot be null.- Returns:
- Can be empty but never null.
-
selectSingle
public XSComponent selectSingle(java.lang.String scd, javax.xml.namespace.NamespaceContext nsContext)
Description copied from interface:XSComponent
Evaluates a schema component designator against this schema component and returns the first resulting schema component.- Specified by:
selectSingle
in interfaceXSComponent
- Parameters:
scd
- Schema component designator. SeeSCD
for more details.nsContext
- The namespace context in which SCD is evaluated. Cannot be null.- Returns:
- null if the SCD didn't match anything. If the SCD matched more than one node, the first one will be returned.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-