Class ComplexType
java.lang.Object
org.exolab.castor.xml.schema.Structure
org.exolab.castor.xml.schema.Annotated
org.exolab.castor.xml.schema.XMLType
org.exolab.castor.xml.schema.ComplexType
- All Implemented Interfaces:
Serializable,ContentModelGroup,Referable
The XML Schema ComplexType class.
- Version:
- $Revision: 7625 $ $Date: 2006-02-01 15:47:48 -0700 (Wed, 01 Feb 2006) $
- Author:
- Keith Visco
- See Also:
-
Field Summary
Fields inherited from class org.exolab.castor.xml.schema.XMLType
NULL_ARGUMENTFields 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
ConstructorsConstructorDescriptionComplexType(Schema schema) Creates a newComplexTypeinstance with no name.ComplexType(Schema schema, String name) Creates a newComplexTypewith the given name. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttributeDecl(AttributeDecl attrDecl) Adds the givenAttributeDeclto thisComplexType.voidaddAttributeGroupReference(AttributeGroupReference attrGroupRef) Adds the given AttributeGroupReference to this ComplexType.voidaddElementDecl(ElementDecl elementDecl) Adds the given ElementDecl to thisContentModelGroup.voidAdds the given Group to thisContentModelGroup.voidaddGroup(ModelGroup group) Adds the given ModelGroup Definition to thisContentModelGroup.voidaddWildcard(Wildcard wildcard) Adds the givenWildcardto thisContentModelGroup.createAttributeDecl(String name) Creates anAttributeDeclwith the given name.Returns an enumeration of all the Particles of this ContentModelGroup.Returns the wilcard used in this complexType (can be null).getAttributeDecl(String name) Returns theAttributeDeclassociated with the given name.Returns an Enumeration of *all* the AttributeDecl objects declared within this ComplexType.Returns an Enumeration of all the AttributeGroup that are referenced within this ComplexType.Returns the base type that this type inherits from.getBlock()Returns the value of the 'block' attribute for this element.Returns the content type of this ComplexType.getElementDecl(String name) Returns the element declaration with the given name, or null if no element declaration with that name exists in this ContentModelGroup.getFinal()Returns the list of values for the final property for this ComplexType, or null if no final values have been set.Returns an Enumeration of *all* locally defined AttributeDecl declared within this ComplexType.intReturns the maximum number of occurances that this ContentModelGroup may appear.intReturns the minimum number of occurances that this ContentModelGroup must appear.Returns the parent of this ComplexType, this value may be null if no parent has been set.getParticle(int index) Returns the Particle at the specified indexintReturns the number of particles contained within this ContentModelGroup.Returns the Id used to Refer to this Object.shortReturns the type of this Schema Structure.booleanhasAny()A helper method that returns true if this complexType contains an <any> element.booleanReturns true if this ComplexType has been marked as Abstract.booleanReturns true if this complexType is a 'complexContent'.booleanbooleanReturns true if this complexType is a redefinition.booleanReturns true if this complexType is a restriction.booleanReturns true if this complexType is a 'simpleContent'.booleanReturns true if this is a top levelComplexType.voidremoveAttributeDecl(AttributeDecl attrDecl) Removes the givenAttributeDeclfrom thisComplexType.voidremoveAttributeGroupReference(AttributeGroupReference attrGroupRef) Removes the givenAttributeGroupReferencefrom thisComplexType.booleanremoveElementDecl(ElementDecl element) Removes the given ElementDecl from this ContentModelGroup.booleanremoveGroup(Group group) Removes the given Group from this ContentModelGroup.booleanremoveGroup(ModelGroup group) Removes the given ModelGroup Definition from this ContentModelGroup.booleanremoveWildcard(Wildcard wildcard) Removes the given Wildcard from this Group.voidsetAbstract(boolean isAbstract) Sets whether or not this ComplexType should be abstract.voidsetAnyAttribute(Wildcard wildcard) Sets the wildcard (anyAttribute) of theComplexType.voidSets the base type that this type is derived from.voidsetBaseType(XMLType baseType) Sets the base type for this ComplexType.voidSets the value of the 'block' attribute for this ComplexType.voidSets the value of the 'block' attribute for this ComplexType.voidsetComplexContent(boolean complexContent) Sets whether or not this complexType is a 'complexContent'.voidsetContentType(ContentType contentType) Sets the content type of this complexType.voidSets the value of the 'final' attribute for this ComplexType definition.voidSets the value of the 'final' attribute for this ComplexType definition.protected voidSets the parent for this ComplexType.voidSets this Group has redefined.voidsetRestriction(boolean restricted) Sets whether or not this complexType is a restriction.voidsetSimpleContent(boolean simpleContent) Sets whether or not this complexType is a 'simpleContent'.voiduseResolver(Resolver resolver) voidvalidate()Checks the validity of this ComplexType defintion.Methods inherited from class org.exolab.castor.xml.schema.XMLType
getBaseTypeName, getDerivationMethod, getId, getName, getSchema, isAnyType, isComplexType, isSimpleType, setDerivationMethod, setId, setName, setSchemaMethods inherited from class org.exolab.castor.xml.schema.Annotated
addAnnotation, getAnnotations, removeAnnotation
-
Constructor Details
-
ComplexType
Creates a newComplexTypeinstance with no name.- Parameters:
schema- the owningSchemadocument
-
ComplexType
Creates a newComplexTypewith the given name.- Parameters:
schema- The owningSchemainstancename- Name of theComplexType
-
-
Method Details
-
addAttributeDecl
Adds the givenAttributeDeclto thisComplexType.- Parameters:
attrDecl- theAttributeDeclto add to thisComplexType
-
removeAttributeDecl
Removes the givenAttributeDeclfrom thisComplexType.- Parameters:
attrDecl- the AttributeDecl to remove.
-
addAttributeGroupReference
Adds the given AttributeGroupReference to this ComplexType.- Parameters:
attrGroupRef- the AttributeGroupReference to add to this ComplexType
-
removeAttributeGroupReference
Removes the givenAttributeGroupReferencefrom thisComplexType.- Parameters:
attrGroupRef- theAttributeGroupReferenceto remove.
-
createAttributeDecl
Creates anAttributeDeclwith the given name. The attribute declaration will still need to be added to thisComplexType, 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
Returns the wilcard used in this complexType (can be null).- Returns:
- the wilcard used in this complexType (can be null)
-
getAttributeDecl
Returns theAttributeDeclassociated with the given name.- Parameters:
name- Name of the associatedAttributeDecl- Returns:
- the
AttributeDeclassociated with the given name, or null if noAttributeDeclwith the given name was found.
-
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 togetLocalAttributeDecls.- Returns:
- an Enumeration of all the AttributeDecl objects declared within this Complextype
-
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
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
Returns the base type that this type inherits from.- Overrides:
getBaseTypein classXMLType- Returns:
- the base type (also called super type).
-
getBlock
Returns the value of the 'block' attribute for this element.- Returns:
- the value of the 'block' attribute for this element
-
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
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
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
Returns the Id used to Refer to this Object.- Specified by:
getReferenceIdin interfaceReferable- Returns:
- the Id used to Refer to this Object
- See Also:
-
hasAny
public boolean hasAny()A helper method that returns true if this complexType contains an <any> element.- Returns:
- method that returns true if this complexType contains an <any> 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 levelComplexType.- Returns:
- true if this is a top level
ComplexType
-
isComplexContent
public boolean isComplexContent()Returns true if this complexType is a 'complexContent'.- Returns:
- true if this complexType is a 'complexContent'
-
isSimpleContent
public boolean isSimpleContent()Returns true if this complexType is a 'simpleContent'.- Returns:
- true if this complexType is a 'simpleContent'
-
isRestricted
public boolean isRestricted()Returns true if this complexType is a restriction.- 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
Sets the wildcard (anyAttribute) of theComplexType.- Throws:
SchemaException- thrown when a wildcard as already be set or when the wildCard is not an <anyAttribute>.
-
removeWildcard
Removes the given Wildcard from this Group.- Specified by:
removeWildcardin interfaceContentModelGroup- Parameters:
wildcard- the Wildcard to remove.- Returns:
- true if the wildcard has been successfully removed, false otherwise.
-
addWildcard
Description copied from interface:ContentModelGroupAdds the givenWildcardto thisContentModelGroup.- Specified by:
addWildcardin interfaceContentModelGroup- Parameters:
wildcard- theWildcardto add- Throws:
SchemaException- when theWildcardis <anyAttribute> and not <any>
-
setBase
Sets the base type that this type is derived from.- Parameters:
base- the type that this type is derived from
-
setBaseType
Sets the base type for this ComplexType.- Overrides:
setBaseTypein classXMLType- Parameters:
baseType- the base type which this ComplexType extends or restricts
-
setBlock
Sets the value of the 'block' attribute for this ComplexType.- Parameters:
block- the value of the block attribute for this ComplexType definition.
-
setBlock
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
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
Sets the value of the 'final' attribute for this ComplexType definition.- Parameters:
finalList- the value of the final attribute for this ComplexType definition.
-
setFinal
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:
simpleContent- true if this complexType is a 'simpleContent'
-
setRestriction
public void setRestriction(boolean restricted) Sets whether or not this complexType is a restriction.- Parameters:
restricted- true if this complexType is a restriction
-
useResolver
-
addElementDecl
Adds the given ElementDecl to thisContentModelGroup.- Specified by:
addElementDeclin interfaceContentModelGroup- Parameters:
elementDecl- the ElementDecl to add- Throws:
SchemaException- when an ElementDecl already exists with the same name as the given ElementDecl
-
removeElementDecl
Removes the given ElementDecl from this ContentModelGroup.- Specified by:
removeElementDeclin interfaceContentModelGroup- Parameters:
element- the ElementDecl to remove.- Returns:
- true if the element has been successfully removed, false otherwise.
-
addGroup
Adds the given Group to thisContentModelGroup.- Specified by:
addGroupin interfaceContentModelGroup- 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
Removes the given Group from this ContentModelGroup.- Specified by:
removeGroupin interfaceContentModelGroup- Parameters:
group- the Group to remove.- Returns:
- true if the group has been successfully removed, false otherwise.
-
addGroup
Adds the given ModelGroup Definition to thisContentModelGroup.- Specified by:
addGroupin interfaceContentModelGroup- 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
Removes the given ModelGroup Definition from this ContentModelGroup.- Specified by:
removeGroupin interfaceContentModelGroup- Parameters:
group- the ModelGroup Definition to remove.- Returns:
- true if the group has been successfully removed, false otherwise.
-
enumerate
Returns an enumeration of all the Particles of this ContentModelGroup.- Specified by:
enumeratein interfaceContentModelGroup- Returns:
- an enumeration of the Particles contained within this ContentModelGroup
-
getElementDecl
Returns the element declaration with the given name, or null if no element declaration with that name exists in this ContentModelGroup.- Specified by:
getElementDeclin interfaceContentModelGroup- 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:
getMaxOccursin interfaceContentModelGroup- Returns:
- the maximum number of occurances that this ContentModelGroup may appear. A non positive (n invalid input: '<' 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:
getMinOccursin interfaceContentModelGroup- Returns:
- the minimum number of occurances that this ContentModelGroup must appear A negative (n invalid input: '<' 0) value indicates that the value is unspecified.
-
getParticle
Returns the Particle at the specified index- Specified by:
getParticlein interfaceContentModelGroup- Parameters:
index- the index of the particle to return- Returns:
- the CMParticle at the specified index
-
getParticleCount
public int getParticleCount()Returns the number of particles contained within this ContentModelGroup.- Specified by:
getParticleCountin interfaceContentModelGroup- Returns:
- the number of particles
-
getStructureType
public short getStructureType()Returns the type of this Schema Structure.- Specified by:
getStructureTypein classStructure- Returns:
- the type of this Schema Structure
-
validate
Checks the validity of this ComplexType defintion.- Specified by:
validatein classStructure- Throws:
ValidationException- when this ComplexType definition is invalid.
-
setParent
-
isEmptiable
public boolean isEmptiable()- Returns:
- true if the content model for this ComplexType is emptiable.
-