com.sun.xml.xsom.impl
Class SchemaImpl

java.lang.Object
  extended by com.sun.xml.xsom.impl.SchemaImpl
All Implemented Interfaces:
XSComponent, XSSchema

public class SchemaImpl
extends Object
implements XSSchema


Field Summary
protected  SchemaSetImpl parent
           
 
Constructor Summary
SchemaImpl(SchemaSetImpl _parent, Locator loc, String tns)
           
 
Method Summary
 void addAttGroupDecl(XSAttGroupDecl newDecl, boolean overwrite)
           
 void addAttributeDecl(XSAttributeDecl newDecl)
           
 void addComplexType(XSComplexType newDecl, boolean overwrite)
           
 void addElementDecl(XSElementDecl newDecl)
           
 void addForeignAttributes(ForeignAttributesImpl fa)
           
protected  void addIdentityConstraint(IdentityConstraintImpl c)
           
 void addModelGroupDecl(XSModelGroupDecl newDecl, boolean overwrite)
           
 void addNotation(XSNotation newDecl)
           
 void addSimpleType(XSSimpleType newDecl, boolean overwrite)
           
 Object apply(XSFunction function)
          Accepts a functor.
 XSAnnotation getAnnotation()
          Gets the annotation associated to this component, if any.
 XSAnnotation getAnnotation(boolean createIfNotExist)
          Works like XSComponent.getAnnotation(), but allow a new empty XSAnnotation to be created if not exist.
 XSAttGroupDecl getAttGroupDecl(String name)
           
 Map<String,XSAttGroupDecl> getAttGroupDecls()
          Gets all the XSAttGroupDecls in this schema.
 XSAttributeDecl getAttributeDecl(String name)
           
 Map<String,XSAttributeDecl> getAttributeDecls()
          Gets all the XSAttributeDecls in this schema keyed by their local names.
 XSComplexType getComplexType(String name)
           
 Map<String,XSComplexType> getComplexTypes()
          Gets all the XSComplexTypes in this schema.
 XSElementDecl getElementDecl(String name)
           
 Map<String,XSElementDecl> getElementDecls()
          Gets all the XSElementDecls in this schema.
 String getForeignAttribute(String nsUri, String localName)
          Gets the foreign attribute of the given name, or null if not found.
 List<ForeignAttributes> getForeignAttributes()
          Gets the foreign attributes on this schema component.
 XSIdentityConstraint getIdentityConstraint(String localName)
          Gets the identity constraint of the given name, or null if not found.
 Map<String,XSIdentityConstraint> getIdentityConstraints()
          Gets all the XSIdentityConstraints in this schema, keyed by their names.
 Locator getLocator()
          Gets the locator that indicates the source location where this component is created from, or null if no information is available.
 XSModelGroupDecl getModelGroupDecl(String name)
           
 Map<String,XSModelGroupDecl> getModelGroupDecls()
          Gets all the XSModelGroupDecls in this schema.
 XSNotation getNotation(String name)
           
 Map<String,XSNotation> getNotations()
          Gets all the XSNotations in this schema.
 XSSchema getOwnerSchema()
          Gets a reference to the XSSchema object to which this component belongs.
 SchemaSetImpl getRoot()
          Gets the root schema set that includes this schema.
 XSSimpleType getSimpleType(String name)
           
 Map<String,XSSimpleType> getSimpleTypes()
          Gets all the XSSimpleTypes in this schema.
 SchemaDocument getSourceDocument()
          Sine an XSSchema is not necessarily defined in one schema document (for example one schema can span across many documents through <xs:include>s.), so this method always returns null.
 String getTargetNamespace()
          Gets the target namespace of the schema.
 XSType getType(String name)
           
 Map<String,XSType> getTypes()
          Gets all the XSTypes in this schema (union of XSSchema.getSimpleTypes() and XSSchema.getComplexTypes()
 Iterator<XSAttGroupDecl> iterateAttGroupDecls()
           
 Iterator<XSAttributeDecl> iterateAttributeDecls()
           
 Iterator<XSComplexType> iterateComplexTypes()
           
 Iterator<XSElementDecl> iterateElementDecls()
           
 Iterator<XSModelGroupDecl> iterateModelGroupDecls()
           
 Iterator<XSNotation> iterateNotations()
           
 Iterator<XSSimpleType> iterateSimpleTypes()
           
 Iterator<XSType> iterateTypes()
           
 Collection<XSComponent> select(String scd, NamespaceContext nsContext)
          Evaluates a schema component designator against this schema component and returns the resulting schema components.
 XSComponent selectSingle(String scd, NamespaceContext nsContext)
          Evaluates a schema component designator against this schema component and returns the first resulting schema component.
 void setAnnotation(XSAnnotation a)
           
 void visit(XSVisitor visitor)
          Accepts a visitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected final SchemaSetImpl parent
Constructor Detail

SchemaImpl

public SchemaImpl(SchemaSetImpl _parent,
                  Locator loc,
                  String tns)
Method Detail

getSourceDocument

public SchemaDocument getSourceDocument()
Description copied from interface: XSSchema
Sine an XSSchema is not necessarily defined in one schema document (for example one schema can span across many documents through <xs:include>s.), so this method always returns null.

Specified by:
getSourceDocument in interface XSComponent
Specified by:
getSourceDocument in interface XSSchema
Returns:
null for components that are built-in to XML Schema, such as anyType, or "empty" XSContentType. This method also returns null for XSSchema. For all other user-defined components this method returns non-null, even if they are local.

getRoot

public SchemaSetImpl getRoot()
Description copied from interface: XSSchema
Gets the root schema set that includes this schema.

Specified by:
getRoot in interface XSComponent
Specified by:
getRoot in interface XSSchema
Returns:
never null.

getTargetNamespace

public String getTargetNamespace()
Description copied from interface: XSSchema
Gets the target namespace of the schema.

Specified by:
getTargetNamespace in interface XSSchema
Returns:
can be empty, but never be null.

getOwnerSchema

public XSSchema getOwnerSchema()
Description copied from interface: XSComponent
Gets a reference to the XSSchema 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 interface XSComponent

setAnnotation

public void setAnnotation(XSAnnotation a)

getAnnotation

public XSAnnotation getAnnotation()
Description copied from interface: XSComponent
Gets the annotation associated to this component, if any.

Specified by:
getAnnotation in interface XSComponent

getAnnotation

public XSAnnotation getAnnotation(boolean createIfNotExist)
Description copied from interface: XSComponent
Works like XSComponent.getAnnotation(), but allow a new empty XSAnnotation to be created if not exist.

Specified by:
getAnnotation in interface XSComponent
Parameters:
createIfNotExist - true to create a new XSAnnotation if it doesn't exist already. false to make this method behavel like XSComponent.getAnnotation().
Returns:
null if createIfNotExist==false and annotation didn't exist. Otherwise non-null.

getLocator

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

addAttributeDecl

public void addAttributeDecl(XSAttributeDecl newDecl)

getAttributeDecls

public Map<String,XSAttributeDecl> getAttributeDecls()
Description copied from interface: XSSchema
Gets all the XSAttributeDecls in this schema keyed by their local names.

Specified by:
getAttributeDecls in interface XSSchema

getAttributeDecl

public XSAttributeDecl getAttributeDecl(String name)
Specified by:
getAttributeDecl in interface XSSchema

iterateAttributeDecls

public Iterator<XSAttributeDecl> iterateAttributeDecls()
Specified by:
iterateAttributeDecls in interface XSSchema

addElementDecl

public void addElementDecl(XSElementDecl newDecl)

getElementDecls

public Map<String,XSElementDecl> getElementDecls()
Description copied from interface: XSSchema
Gets all the XSElementDecls in this schema.

Specified by:
getElementDecls in interface XSSchema

getElementDecl

public XSElementDecl getElementDecl(String name)
Specified by:
getElementDecl in interface XSSchema

iterateElementDecls

public Iterator<XSElementDecl> iterateElementDecls()
Specified by:
iterateElementDecls in interface XSSchema

addAttGroupDecl

public void addAttGroupDecl(XSAttGroupDecl newDecl,
                            boolean overwrite)

getAttGroupDecls

public Map<String,XSAttGroupDecl> getAttGroupDecls()
Description copied from interface: XSSchema
Gets all the XSAttGroupDecls in this schema.

Specified by:
getAttGroupDecls in interface XSSchema

getAttGroupDecl

public XSAttGroupDecl getAttGroupDecl(String name)
Specified by:
getAttGroupDecl in interface XSSchema

iterateAttGroupDecls

public Iterator<XSAttGroupDecl> iterateAttGroupDecls()
Specified by:
iterateAttGroupDecls in interface XSSchema

addNotation

public void addNotation(XSNotation newDecl)

getNotations

public Map<String,XSNotation> getNotations()
Description copied from interface: XSSchema
Gets all the XSNotations in this schema.

Specified by:
getNotations in interface XSSchema

getNotation

public XSNotation getNotation(String name)
Specified by:
getNotation in interface XSSchema

iterateNotations

public Iterator<XSNotation> iterateNotations()
Specified by:
iterateNotations in interface XSSchema

addModelGroupDecl

public void addModelGroupDecl(XSModelGroupDecl newDecl,
                              boolean overwrite)

getModelGroupDecls

public Map<String,XSModelGroupDecl> getModelGroupDecls()
Description copied from interface: XSSchema
Gets all the XSModelGroupDecls in this schema.

Specified by:
getModelGroupDecls in interface XSSchema

getModelGroupDecl

public XSModelGroupDecl getModelGroupDecl(String name)
Specified by:
getModelGroupDecl in interface XSSchema

iterateModelGroupDecls

public Iterator<XSModelGroupDecl> iterateModelGroupDecls()
Specified by:
iterateModelGroupDecls in interface XSSchema

addIdentityConstraint

protected void addIdentityConstraint(IdentityConstraintImpl c)

getIdentityConstraints

public Map<String,XSIdentityConstraint> getIdentityConstraints()
Description copied from interface: XSSchema
Gets all the XSIdentityConstraints in this schema, keyed by their names.

Specified by:
getIdentityConstraints in interface XSSchema

getIdentityConstraint

public XSIdentityConstraint getIdentityConstraint(String localName)
Description copied from interface: XSSchema
Gets the identity constraint of the given name, or null if not found.

Specified by:
getIdentityConstraint in interface XSSchema

addSimpleType

public void addSimpleType(XSSimpleType newDecl,
                          boolean overwrite)

getSimpleTypes

public Map<String,XSSimpleType> getSimpleTypes()
Description copied from interface: XSSchema
Gets all the XSSimpleTypes in this schema.

Specified by:
getSimpleTypes in interface XSSchema

getSimpleType

public XSSimpleType getSimpleType(String name)
Specified by:
getSimpleType in interface XSSchema

iterateSimpleTypes

public Iterator<XSSimpleType> iterateSimpleTypes()
Specified by:
iterateSimpleTypes in interface XSSchema

addComplexType

public void addComplexType(XSComplexType newDecl,
                           boolean overwrite)

getComplexTypes

public Map<String,XSComplexType> getComplexTypes()
Description copied from interface: XSSchema
Gets all the XSComplexTypes in this schema.

Specified by:
getComplexTypes in interface XSSchema

getComplexType

public XSComplexType getComplexType(String name)
Specified by:
getComplexType in interface XSSchema

iterateComplexTypes

public Iterator<XSComplexType> iterateComplexTypes()
Specified by:
iterateComplexTypes in interface XSSchema

getTypes

public Map<String,XSType> getTypes()
Description copied from interface: XSSchema
Gets all the XSTypes in this schema (union of XSSchema.getSimpleTypes() and XSSchema.getComplexTypes()

Specified by:
getTypes in interface XSSchema

getType

public XSType getType(String name)
Specified by:
getType in interface XSSchema

iterateTypes

public Iterator<XSType> iterateTypes()
Specified by:
iterateTypes in interface XSSchema

visit

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

Specified by:
visit in interface XSComponent

apply

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

Specified by:
apply in interface XSComponent

addForeignAttributes

public void addForeignAttributes(ForeignAttributesImpl fa)

getForeignAttributes

public List<ForeignAttributes> 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 each ForeignAttributes object represent foreign attributes on one element.

Specified by:
getForeignAttributes in interface XSComponent
Returns:
can be an empty list but never be null.

getForeignAttribute

public String getForeignAttribute(String nsUri,
                                  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 interface XSComponent
See Also:
XSComponent.getForeignAttributes()

select

public Collection<XSComponent> select(String scd,
                                      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 interface XSComponent
Parameters:
scd - Schema component designator. See SCD 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(String scd,
                                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 interface XSComponent
Parameters:
scd - Schema component designator. See SCD 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.


Copyright © 2012 Oracle. All Rights Reserved.