Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.common.schema.model.impl
Class DefaultTypeDefinition

java.lang.Object
  extended by eu.esdihumboldt.hale.common.schema.model.impl.AbstractDefinition<TypeConstraint>
      extended by eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeDefinition
All Implemented Interfaces:
Locatable, Definition<TypeConstraint>, DefinitionGroup, TypeDefinition, Comparable<Definition<?>>
Direct Known Subclasses:
XmlTypeDefinition

public class DefaultTypeDefinition
extends AbstractDefinition<TypeConstraint>
implements TypeDefinition

Default TypeDefinition implementation.

Author:
Simon Templer

Field Summary
 
Fields inherited from class eu.esdihumboldt.hale.common.schema.model.impl.AbstractDefinition
name
 
Constructor Summary
DefaultTypeDefinition(QName name)
          Create a type definition with the given name
 
Method Summary
 void addChild(ChildDefinition<?> child)
          Add a declared child, this is called by the AbstractChildDefinition constructor.
protected  void addSubType(DefaultTypeDefinition subtype)
          Add a sub-type
 ChildDefinition<?> getChild(QName name)
          Get the child with the given name
 Collection<? extends ChildDefinition<?>> getChildren()
          Get all children that an instance of the type may have.
 Collection<? extends ChildDefinition<?>> getDeclaredChildren()
          Get the properties and property groups declared by the type
 String getIdentifier()
          Get the definitions identifier
protected  Map<QName,ChildDefinition<?>> getInheritedChildren()
          Get the unmodifiable map of inherited children.
protected
<T extends TypeConstraint>
T
getInheritedConstraint(Class<T> constraintType)
          Get the inherited constraint of the given constraint type.

This implementation returns null, as inheritance is not supported generally for definitions.
 Collection<? extends DefaultTypeDefinition> getSubTypes()
          Get the sub types
 DefaultTypeDefinition getSuperType()
          Get the super type
protected  void removeSubType(DefaultTypeDefinition subtype)
          Remove a sub-type
 void setSuperType(DefaultTypeDefinition superType)
          Set the type's super type.
 String toString()
           
 
Methods inherited from class eu.esdihumboldt.hale.common.schema.model.impl.AbstractDefinition
compareTo, equals, getConstraint, getDescription, getDisplayName, getLocation, getName, hasConstraint, hashCode, setConstraint, setConstraintIfNotSet, setDescription, setLocation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface eu.esdihumboldt.hale.common.schema.model.Definition
getConstraint, getDescription, getDisplayName, getName
 
Methods inherited from interface eu.esdihumboldt.hale.common.core.io.supplier.Locatable
getLocation
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

DefaultTypeDefinition

public DefaultTypeDefinition(QName name)
Create a type definition with the given name

Parameters:
name - the type name
Method Detail

getIdentifier

public String getIdentifier()
Description copied from interface: Definition
Get the definitions identifier

Specified by:
getIdentifier in interface Definition<TypeConstraint>
Specified by:
getIdentifier in interface DefinitionGroup
Overrides:
getIdentifier in class AbstractDefinition<TypeConstraint>
Returns:
the unique name of the definition
See Also:
Definition.getIdentifier()

getDeclaredChildren

public Collection<? extends ChildDefinition<?>> getDeclaredChildren()
Description copied from interface: DefinitionGroup
Get the properties and property groups declared by the type

Specified by:
getDeclaredChildren in interface DefinitionGroup
Returns:
the definitions of the declared properties and groups
See Also:
DefinitionGroup.getDeclaredChildren()

addChild

public void addChild(ChildDefinition<?> child)
Description copied from interface: DefinitionGroup
Add a declared child, this is called by the AbstractChildDefinition constructor.

Specified by:
addChild in interface DefinitionGroup
Parameters:
child - the child definition
See Also:
DefinitionGroup.addChild(ChildDefinition)

getInheritedChildren

protected Map<QName,ChildDefinition<?>> getInheritedChildren()
Get the unmodifiable map of inherited children.

Returns:
the inherited children, names mapped to definitions

getChildren

public Collection<? extends ChildDefinition<?>> getChildren()
Get all children that an instance of the type may have. Usually these are the declared children and the super type children.
May not be called while creating the model.

Specified by:
getChildren in interface TypeDefinition
Returns:
the child definitions
See Also:
TypeDefinition.getChildren()

getInheritedConstraint

protected <T extends TypeConstraint> T getInheritedConstraint(Class<T> constraintType)
Description copied from class: AbstractDefinition
Get the inherited constraint of the given constraint type.

This implementation returns null, as inheritance is not supported generally for definitions.

Overrides:
getInheritedConstraint in class AbstractDefinition<TypeConstraint>
Parameters:
constraintType - the constraint type
Returns:
the inherited constraint or null if there is none or inheritance is not allowed
See Also:
AbstractDefinition.getInheritedConstraint(Class)

getSuperType

public DefaultTypeDefinition getSuperType()
Description copied from interface: TypeDefinition
Get the super type

Specified by:
getSuperType in interface TypeDefinition
Returns:
the super type, may be null
See Also:
TypeDefinition.getSuperType()

setSuperType

public void setSuperType(DefaultTypeDefinition superType)
Set the type's super type. This will add this type to the super type's sub-type list and remove it from the previous super type (if any).

Parameters:
superType - the super-type to set

removeSubType

protected void removeSubType(DefaultTypeDefinition subtype)
Remove a sub-type

Parameters:
subtype - the sub-type to remove
See Also:
setSuperType(DefaultTypeDefinition)

addSubType

protected void addSubType(DefaultTypeDefinition subtype)
Add a sub-type

Parameters:
subtype - the sub-type to add
See Also:
setSuperType(DefaultTypeDefinition)

getSubTypes

public Collection<? extends DefaultTypeDefinition> getSubTypes()
Description copied from interface: TypeDefinition
Get the sub types

Specified by:
getSubTypes in interface TypeDefinition
Returns:
the list of sub types, may not be modified
See Also:
TypeDefinition.getSubTypes()

getChild

public ChildDefinition<?> getChild(QName name)
Get the child with the given name
May not be called while creating the model.

Specified by:
getChild in interface DefinitionGroup
Parameters:
name - the child name
Returns:
the child definition or null if no child with the given name is available
See Also:
DefinitionGroup.getChild(QName)

toString

public String toString()
Overrides:
toString in class AbstractDefinition<TypeConstraint>
See Also:
AbstractDefinition.toString()

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d