org.exolab.castor.xml.schema
Class ComplexType

java.lang.Object
  extended by org.exolab.castor.xml.schema.Structure
      extended by org.exolab.castor.xml.schema.Annotated
          extended by org.exolab.castor.xml.schema.XMLType
              extended by org.exolab.castor.xml.schema.ComplexType
All Implemented Interfaces:
java.io.Serializable, ContentModelGroup, Referable

public class ComplexType
extends XMLType
implements ContentModelGroup, Referable

The XML Schema ComplexType class

Version:
$Revision: 1.6 $ $Date: 2004/10/01 13:25:21 $
Author:
Keith Visco
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.exolab.castor.xml.schema.XMLType
NULL_ARGUMENT
 
Fields inherited from class org.exolab.castor.xml.schema.Structure
ANNOTATION, ANYTYPE, APPINFO, ATTRIBUTE, ATTRIBUTE_GROUP, COMPLEX_CONTENT, COMPLEX_TYPE, DOCUMENTATION, ELEMENT, FACET, GROUP, IDENTITY_FIELD, IDENTITY_SELECTOR, KEY, KEYREF, LIST, MODELGROUP, MODELGROUP_REF, REDEFINE, SCHEMA, SIMPLE_CONTENT, SIMPLE_TYPE, UNION, UNIQUE, UNKNOWN, WILDCARD
 
Constructor Summary
ComplexType(Schema schema)
          Creates a new Complextype, with no name
ComplexType(Schema schema, java.lang.String name)
          Creates a new Complextype with the given name
 
Method Summary
 void addAttributeDecl(AttributeDecl attrDecl)
          Adds the given AttributeDecl to this ComplexType
 void addAttributeGroupReference(AttributeGroupReference attrGroupRef)
          Adds the given AttributeGroupReference to this ComplexType
 void addElementDecl(ElementDecl elementDecl)
          Adds the given ElementDecl to this ContentModelGroup
 void addGroup(Group group)
          Adds the given Group to this ContentModelGroup
 void addGroup(ModelGroup group)
          Adds the given ModelGroup Definition to this ContentModelGroup
 void addWildcard(Wildcard wildcard)
          Adds the given wildcard to this ContentModelGroup
 AttributeDecl createAttributeDecl(java.lang.String name)
          Creates an AttributeDecl with the given name.
 java.util.Enumeration enumerate()
          Returns an enumeration of all the Particles of this ContentModelGroup
 Wildcard getAnyAttribute()
          Returns the wilcard used in this complexType (can be null)
 AttributeDecl getAttributeDecl(java.lang.String name)
          Returns the AttributeDecl associated with the given name
 java.util.Enumeration getAttributeDecls()
          Returns an Enumeration of *all* the AttributeDecl objects declared within this ComplexType.
 java.util.Enumeration getAttributeGroupReferences()
          Returns an Enumeration of all the AttributeGroup that are referenced within this ComplexType.
 XMLType getBaseType()
          Returns the base type that this type inherits from.
 BlockList getBlock()
          Returns the value of the 'block' attribute for this element
 ContentType getContentType()
          Returns the content type of this ComplexType.
 ElementDecl getElementDecl(java.lang.String name)
          Returns the element declaration with the given name, or null if no element declaration with that name exists in this ContentModelGroup.
 FinalList getFinal()
          Returns the list of values for the final property for this ComplexType, or null if no final values have been set.
 java.util.Enumeration getLocalAttributeDecls()
          Returns an Enumeration of *all* locally defined AttributeDecl declared within this ComplexType.
 int getMaxOccurs()
          Returns the maximum number of occurances that this ContentModelGroup may appear
 int getMinOccurs()
          Returns the minimum number of occurances that this ContentModelGroup must appear
 Structure getParent()
          Returns the parent of this ComplexType, this value may be null if no parent has been set.
 Particle getParticle(int index)
          Returns the Particle at the specified index
 int getParticleCount()
          Returns the number of particles contained within this ContentModelGroup
 java.lang.String getReferenceId()
          Returns the Id used to Refer to this Object
 short getStructureType()
          Returns the type of this Schema Structure
 boolean hasAny()
          A helper method that returns true if this complexType contains an element.
 boolean isAbstract()
          Returns true if this ComplexType has been marked as Abstract.
 boolean isComplexContent()
          Returns true if this complexType is a 'complexContent'
 boolean isRedefined()
          Returns true if this complexType is a redefinition.
 boolean isRestricted()
          Returns true if this complexType is a restriction
 boolean isSimpleContent()
          Returns true if this complexType is a 'simpleContent'
 boolean isTopLevel()
          Returns true if this is a top level Complextype
 void removeAttributeDecl(AttributeDecl attrDecl)
          Removes the given AttributeDecl from this ComplexType
 void removeAttributeGroupReference(AttributeGroupReference attrGroupRef)
          Removes the given AttributeGroupReference from this ComplexType
 boolean removeElementDecl(ElementDecl element)
          Removes the given ElementDecl from this ContentModelGroup.
 boolean removeGroup(Group group)
          Removes the given Group from this ContentModelGroup.
 boolean removeGroup(ModelGroup group)
          Removes the given ModelGroup Definition from this ContentModelGroup.
 boolean removeWildcard(Wildcard wildcard)
          Removes the given Wildcard from this Group.
 void setAbstract(boolean isAbstract)
          Sets whether or not this ComplexType should be abstract.
 void setAnyAttribute(Wildcard wildcard)
          Sets the wildcard (anyAttribute) of the complexType
 void setBase(java.lang.String base)
          Sets the base type that this type is derived from
 void setBaseType(XMLType baseType)
          Sets the base type for this ComplexType
 void setBlock(BlockList block)
          Sets the value of the 'block' attribute for this ComplexType.
 void setBlock(java.lang.String block)
          Sets the value of the 'block' attribute for this ComplexType.
 void setComplexContent(boolean complexContent)
          Sets whether or not this complexType is a 'complexContent'
 void setContentType(ContentType contentType)
          Sets the content type of this complexType.
 void setFinal(FinalList finalList)
          Sets the value of the 'final' attribute for this ComplexType definition.
 void setFinal(java.lang.String finalValue)
          Sets the value of the 'final' attribute for this ComplexType definition.
protected  void setParent(Structure parent)
          Sets the parent for this ComplexType
 void setRedefined()
          Sets this Group has redefined.
 void setRestriction(boolean restricted)
          Sets whether or not this complexType is a restriction
 void setSimpleContent(boolean simpleContent)
          Sets whether or not this complexType is a 'simpleContent'
 void useResolver(Resolver resolver)
           
 void validate()
          Checks the validity of this ComplexType defintion.
 
Methods inherited from class org.exolab.castor.xml.schema.XMLType
getDerivationMethod, getId, getName, getSchema, getType, isAnyType, isComplexType, isSimpleType, setDerivationMethod, setId, setName, setSchema
 
Methods inherited from class org.exolab.castor.xml.schema.Annotated
addAnnotation, getAnnotations, removeAnnotation
 
Methods inherited from class org.exolab.castor.xml.schema.Structure
isValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComplexType

public ComplexType(Schema schema)
Creates a new Complextype, with no name

Parameters:
schema - the owning Schema document

ComplexType

public ComplexType(Schema schema,
                   java.lang.String name)
Creates a new Complextype with the given name

Parameters:
schema - the owning Schema
name - of the Complextype
Method Detail

addAttributeDecl

public void addAttributeDecl(AttributeDecl attrDecl)
                      throws SchemaException
Adds the given AttributeDecl to this ComplexType

Parameters:
attrDecl - the AttributeDecl to add to this ComplexType
Throws:
SchemaException - when an AttributeDecl already exists with the same name as the given AttributeDecl

removeAttributeDecl

public void removeAttributeDecl(AttributeDecl attrDecl)
Removes the given AttributeDecl from this ComplexType

Parameters:
attrDecl - the AttributeDecl to remove.

addAttributeGroupReference

public void addAttributeGroupReference(AttributeGroupReference attrGroupRef)
Adds the given AttributeGroupReference to this ComplexType

Parameters:
attrGroupRef - the AttributeGroupReference to add to this ComplexType

removeAttributeGroupReference

public void removeAttributeGroupReference(AttributeGroupReference attrGroupRef)
Removes the given AttributeGroupReference from this ComplexType

Parameters:
attrGroupRef - the AttributeGroupReference to remove.

createAttributeDecl

public AttributeDecl createAttributeDecl(java.lang.String name)
Creates an AttributeDecl with the given name. The attribute declaration will still need to be added to this Complextype, or another archetype in the same schema, by making a call to #addAttributeDecl

Parameters:
name - the name of the attribute
Returns:
the new AttributeDecl

getAnyAttribute

public Wildcard getAnyAttribute()
Returns the wilcard used in this complexType (can be null)

Returns:
the wilcard used in this complexType (can be null)

getAttributeDecl

public AttributeDecl getAttributeDecl(java.lang.String name)
Returns the AttributeDecl associated with the given name

Returns:
the AttributeDecl associated with the given name, or null if no AttributeDecl with the given name was found.

getAttributeDecls

public java.util.Enumeration getAttributeDecls()
Returns an Enumeration of *all* the AttributeDecl objects declared within this ComplexType. The Enumeration will contain all AttributeDecl from AttributeGroup references as well. To return only locally declared attributes make a call to getLocalAttributeDecls.

Returns:
an Enumeration of all the AttributeDecl objects declared within this Complextype

getLocalAttributeDecls

public java.util.Enumeration getLocalAttributeDecls()
Returns an Enumeration of *all* locally defined AttributeDecl declared within this ComplexType. The Enumeration will not contain any AttributeDecl from AttributeGroup references.

Returns:
an Enumeration of all locally declared AttributeDecl.

getAttributeGroupReferences

public java.util.Enumeration getAttributeGroupReferences()
Returns an Enumeration of all the AttributeGroup that are referenced within this ComplexType.

Returns:
an Enumeration of all the AttributeGroup that are referenced within this ComplexType.

getBaseType

public XMLType getBaseType()
Returns the base type that this type inherits from.

Overrides:
getBaseType in class XMLType
Returns:
the base type (also called super type).

getBlock

public BlockList getBlock()
Returns the value of the 'block' attribute for this element

Returns:
the value of the 'block' attribute for this element

getContentType

public ContentType getContentType()
Returns the content type of this ComplexType. The Content Type holds the information about the content of the complexType. For instance, if this complexType is a simpleContent then the simpleType information will be hold in the content type.

Returns:
the content type of this ComplexType

getFinal

public FinalList getFinal()
Returns the list of values for the final property for this ComplexType, or null if no final values have been set.

Returns:
the FinalList for this ComplexType

getParent

public Structure getParent()
Returns the parent of this ComplexType, this value may be null if no parent has been set.

Returns:
the parent Structure of this ComplexType.

getReferenceId

public java.lang.String getReferenceId()
Returns the Id used to Refer to this Object

Specified by:
getReferenceId in interface Referable
Returns:
the Id used to Refer to this Object
See Also:
Referable

hasAny

public boolean hasAny()
A helper method that returns true if this complexType contains an element.

Returns:
method that returns true if this complexType contains an element.

isAbstract

public boolean isAbstract()
Returns true if this ComplexType has been marked as Abstract.

Returns:
true if this ComplexType is "abstract".

isRedefined

public boolean isRedefined()
Returns true if this complexType is a redefinition.

Returns:
true if this complexType is a redefinition.

isTopLevel

public boolean isTopLevel()
Returns true if this is a top level Complextype

Returns:
true if this is a top level Complextype

isComplexContent

public boolean isComplexContent()
Returns true if this complexType is a 'complexContent'


isSimpleContent

public boolean isSimpleContent()
Returns true if this complexType is a 'simpleContent'


isRestricted

public boolean isRestricted()
Returns true if this complexType is a restriction


setAbstract

public void setAbstract(boolean isAbstract)
Sets whether or not this ComplexType should be abstract.

Parameters:
isAbstract - a boolean that when true makes this ComplexType abstract.

setAnyAttribute

public void setAnyAttribute(Wildcard wildcard)
                     throws SchemaException
Sets the wildcard (anyAttribute) of the complexType

Throws:
SchemaException - thrown when a wildcard as already be set or when the wildCard is not an .

removeWildcard

public boolean removeWildcard(Wildcard wildcard)
Removes the given Wildcard from this Group.

Specified by:
removeWildcard in interface ContentModelGroup
Parameters:
wilcard - the Wildcard to remove.
Returns:
true if the wildcard has been successfully removed, false otherwise.

addWildcard

public void addWildcard(Wildcard wildcard)
                 throws SchemaException
Description copied from interface: ContentModelGroup
Adds the given wildcard to this ContentModelGroup

Specified by:
addWildcard in interface ContentModelGroup
Parameters:
wildcard - the wilcard to add
Throws:
SchemaException - when the wilcard is and not

setBase

public void setBase(java.lang.String base)
Sets the base type that this type is derived from

Parameters:
base - the type that this type is derived from

setBaseType

public void setBaseType(XMLType baseType)
Sets the base type for this ComplexType

Overrides:
setBaseType in class XMLType
Parameters:
baseType - the base type which this ComplexType extends or restricts

setBlock

public void setBlock(BlockList block)
Sets the value of the 'block' attribute for this ComplexType.

Parameters:
block - the value of the block attribute for this ComplexType definition.

setBlock

public void setBlock(java.lang.String block)
Sets the value of the 'block' attribute for this ComplexType.

Parameters:
block - the value of the block attribute for this ComplexType definition.

setComplexContent

public void setComplexContent(boolean complexContent)
Sets whether or not this complexType is a 'complexContent'

Parameters:
complexContent - true if this complexType is a 'complexContent'

setContentType

public void setContentType(ContentType contentType)
Sets the content type of this complexType. The Content Type holds the information about the content of the complexType. For instance, if this complexType is a simpleContent then the simpleType information will be hold in the content type.

Parameters:
contentType - the ContentType for this complexType

setFinal

public void setFinal(FinalList finalList)
Sets the value of the 'final' attribute for this ComplexType definition.

Parameters:
finalList - the value of the final attribute for this ComplexType definition.

setFinal

public void setFinal(java.lang.String finalValue)
Sets the value of the 'final' attribute for this ComplexType definition.

Parameters:
finalValue - the value of the final attribute for this ComplexType definition.

setRedefined

public void setRedefined()
Sets this Group has redefined.


setSimpleContent

public void setSimpleContent(boolean simpleContent)
Sets whether or not this complexType is a 'simpleContent'

Parameters:
complexContent - true if this complexType is a 'simpleContent'

setRestriction

public void setRestriction(boolean restricted)
Sets whether or not this complexType is a restriction

Parameters:
complexContent - true if this complexType is a restriction

useResolver

public void useResolver(Resolver resolver)

addElementDecl

public void addElementDecl(ElementDecl elementDecl)
                    throws SchemaException
Adds the given ElementDecl to this ContentModelGroup

Specified by:
addElementDecl in interface ContentModelGroup
Parameters:
elementDecl - the ElementDecl to add
Throws:
SchemaException - when an ElementDecl already exists with the same name as the given ElementDecl

removeElementDecl

public boolean removeElementDecl(ElementDecl element)
Removes the given ElementDecl from this ContentModelGroup.

Specified by:
removeElementDecl in interface ContentModelGroup
Parameters:
elementDecl - the ElementDecl to remove.
Returns:
true if the element has been successfully removed, false otherwise.

addGroup

public void addGroup(Group group)
              throws SchemaException
Adds the given Group to this ContentModelGroup

Specified by:
addGroup in interface ContentModelGroup
Parameters:
group - the Group to add
Throws:
SchemaException - when a group with the same name as the specified group already exists in the current scope

removeGroup

public boolean removeGroup(Group group)
Removes the given Group from this ContentModelGroup.

Specified by:
removeGroup in interface ContentModelGroup
Parameters:
group - the Group to remove.
Returns:
true if the group has been successfully removed, false otherwise.

addGroup

public void addGroup(ModelGroup group)
              throws SchemaException
Adds the given ModelGroup Definition to this ContentModelGroup

Specified by:
addGroup in interface ContentModelGroup
Parameters:
group - the ModelGroup to add
Throws:
SchemaException - when a group with the same name as the specified group already exists in the current scope

removeGroup

public boolean removeGroup(ModelGroup group)
Removes the given ModelGroup Definition from this ContentModelGroup.

Specified by:
removeGroup in interface ContentModelGroup
Parameters:
group - the ModelGroup Definition to remove.
Returns:
true if the group has been successfully removed, false otherwise.

enumerate

public java.util.Enumeration enumerate()
Returns an enumeration of all the Particles of this ContentModelGroup

Specified by:
enumerate in interface ContentModelGroup
Returns:
an enumeration of the Particles contained within this ContentModelGroup

getElementDecl

public ElementDecl getElementDecl(java.lang.String name)
Returns the element declaration with the given name, or null if no element declaration with that name exists in this ContentModelGroup.

Specified by:
getElementDecl in interface ContentModelGroup
Parameters:
name - the name of the element.
Returns:
the ElementDecl with the given name, or null if no ElementDecl exists in this ContentModelGroup.

getMaxOccurs

public int getMaxOccurs()
Returns the maximum number of occurances that this ContentModelGroup may appear

Specified by:
getMaxOccurs in interface ContentModelGroup
Returns:
the maximum number of occurances that this ContentModelGroup may appear. A non positive (n < 1) value indicates that the value is unspecified (ie. unbounded).

getMinOccurs

public int getMinOccurs()
Returns the minimum number of occurances that this ContentModelGroup must appear

Specified by:
getMinOccurs in interface ContentModelGroup
Returns:
the minimum number of occurances that this ContentModelGroup must appear A negative (n < 0) value indicates that the value is unspecified.

getParticle

public Particle getParticle(int index)
Returns the Particle at the specified index

Specified by:
getParticle in interface ContentModelGroup
Parameters:
index - the index of the particle to return

getParticleCount

public int getParticleCount()
Returns the number of particles contained within this ContentModelGroup

Specified by:
getParticleCount in interface ContentModelGroup
Returns:
the number of particles

getStructureType

public short getStructureType()
Returns the type of this Schema Structure

Specified by:
getStructureType in class Structure
Returns:
the type of this Schema Structure

validate

public void validate()
              throws ValidationException
Checks the validity of this ComplexType defintion.

Specified by:
validate in class Structure
Throws:
ValidationException - when this ComplexType definition is invalid.

setParent

protected void setParent(Structure parent)
Sets the parent for this ComplexType

Specified by:
setParent in class XMLType
Parameters:
parent - the parent Structure for this ComplexType


Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com