org.jbind.xml.core.type
Interface IAnyType

All Superinterfaces:
IComponent, IHasBindingAttributes, IHasLocation, ISourceInfo
All Known Subinterfaces:
IAnySimpleType, IAtomicType, IComplexCCType, IComplexSCType, IComplexType, IListType, IRestrictedSimpleType, ISimpleType, IUnionType
All Known Implementing Classes:
AbstractListType, AbstractType, BuiltInAtomicType, BuiltInSimpleType, ComplexType, ComplexTypeCC, ComplexTypeSC, RestrictedAtomicType, RestrictedListType, RestrictedSimpleType, RestrictedUnionType, SimpleType, UnionType

public interface IAnyType
extends IComponent

Represents a type.


Method Summary
 void addDirectSubtype(IAnyType aType)
          Adds a type to the collection of direct subtypes.
 boolean canBeOverloadedBy(IAnyType aType)
          Checks if this type can be overloaded by the specified type.
 void checkConstraints(ICheckContext aContext)
          Checks the constraints of this type.
 void checkEnclosedConstraints(ICheckContext aContext)
          Checks the enclosed constraints.
 IAnyTypeData createData(IDataImpl anImpl)
          Creates a data object for the specified data implementation.
 IAnyTypeData createEmptyData(IDataImpl aDataImpl)
          Creates an empty data object for the specified implementation.
 IAnyTypeData createUncheckedData(IDataImpl anImpl)
          Creates a data object for the specified data implementation.
 IAttrDesc getAttrDesc(java.lang.String aNamespace, java.lang.String aName, IHasLocation aHasLocation)
          Gets an attribute description.
 IAttributesModel getAttributesModel()
          Gets the attributes model.
 IAnyType getBaseType()
          Gets the base type.
 IConstraints getConstraints()
          Gets the constraints imposed on this type.
 IContentModel getContentModel()
          Gets the content model.
 IDataCreator getDataCreator()
          Gets the data creator.
 java.util.Collection getDirectSubtypes()
          Gets the types that are direct subtypes of this type.
 IElemDesc getElemDesc(java.lang.String aNamespace, java.lang.String aName)
          Gets an element description.
 IAnyType getInstanceType()
          Gets the type that instances of this type have.
 java.lang.String getRoleName()
          Gets the role name of the type.
 ISimpleType getSimpleContentType()
          Gets the type of the simple content.
 java.lang.Class getSimpleStorageType()
          Gets the simple storage type.
 java.util.Collection getSubtypes()
          Recursively collects the subtypes of this type.
 java.util.Map getXPathMethods()
          Gets the map of XPath methods that are available for this type.
 boolean isAbstract()
          Checks if the type is abstract.
 boolean isActive(BlockType aBlockType)
          Checks if the specified block type is active.
 boolean isActive(FinalType aFinalType)
          Checks if the specified final type is active.
 boolean isBaseType(IAnyType aType)
          Checks if this type is a base type of the specified type.
 boolean isComplex()
          Checks if the type is a complex type.
 boolean isExtension()
          Checks if the type was derived by extension from its direct base type.
 boolean isExtension(IAnyType aType)
          Checks if this type is an extension of the specified type.
 boolean isInstanceType(IAnyType aType)
          Checks if this type is an instance type of the specified type.
 boolean isRestriction(IAnyType aType)
          Checks if this type is a restriction of the specified type.
 boolean isSimple()
          Checks if the type is a simple type.
 void setBaseType(IAnyType aType)
          Sets the base type.
 void setConstraints(IConstraints aConstraints)
          Sets the constraints.
 void setDataCreator(IDataCreator aCreator)
          Sets the data creator.
 
Methods inherited from interface org.jbind.xml.core.cmp.IComponent
accept, addSubComponent, getBindings, getGlobalRef, getName, getNamespace, getParentComponent, getSymbolspace, isAnonymous, isReference, isTopLevelComponent, setBindings, setParentComponent, validate
 
Methods inherited from interface org.jbind.xml.core.cmp.ISourceInfo
getAnnotation, getPrefixToNamespaceMapping
 
Methods inherited from interface org.jbind.xml.base.IHasLocation
getLocation
 
Methods inherited from interface org.jbind.xml.base.IHasBindingAttributes
getBindingAttribute, getDefaultedLocalBindingAttribute, getDefaultedLocalStringBindingAttribute, getLocalBindingAttribute, getLocalStringBindingAttribute, getStringBindingAttribute
 

Method Detail

getAttrDesc

public IAttrDesc getAttrDesc(java.lang.String aNamespace,
                             java.lang.String aName,
                             IHasLocation aHasLocation)
                      throws XmlException
Gets an attribute description.

Parameters:
aNamespace - (required).
aName - (required).
aHasLocation - (optional).
Returns:
(optional). If no declaration is returned then the attribute is to be skipped.
Throws:
XmlException - Raised iff the specified attribute is not allowed for the type.

getElemDesc

public IElemDesc getElemDesc(java.lang.String aNamespace,
                             java.lang.String aName)
                      throws XmlException
Gets an element description.

Parameters:
aNamespace - (required).
aName - (required).
Returns:
(optional).
Throws:
XmlException - Raised iff the specified element is not contained in the type.

isBaseType

public boolean isBaseType(IAnyType aType)
Checks if this type is a base type of the specified type. A type is a base type of some other type if it is the same type or the other type was either directly or indirectly derived from it.

Parameters:
aType - The type to check. (optional)
Returns:
Returns true iff this type is a base type of the specified type.

isExtension

public boolean isExtension()
Checks if the type was derived by extension from its direct base type.

Returns:
Returns true iff the type was derived by extension from its base type.

isExtension

public boolean isExtension(IAnyType aType)
Checks if this type is an extension of the specified type. A type is an extension of another type if there is at least one derivation step in between them that is an extension.

Parameters:
aType - (required).
Returns:
Returns true iff this type is an extension of the specified type.

isRestriction

public boolean isRestriction(IAnyType aType)
Checks if this type is a restriction of the specified type. A type is a restriction of another type if there is at least one derivation step in between them that is a restriction.

Parameters:
aType - (required).
Returns:
Returns true iff this type is a restriction of the specified type.

canBeOverloadedBy

public boolean canBeOverloadedBy(IAnyType aType)
Checks if this type can be overloaded by the specified type. In general, all sub types of this type are valid overloading types. If this type is a union type then the specified type can also be an overloading type of any of the member types. Overloading constraints (i.e. that a type is blocked for extension or restriction) are not checked.

Parameters:
aType - (required). The overloading type
Returns:
Returns true iff the specified type can overload this type.

isInstanceType

public boolean isInstanceType(IAnyType aType)
Checks if this type is an instance type of the specified type. In general, this type is an instance type of the specified type if the specified type is a base type of this type. If this type is a union type then this type is also an instance type if any of the union member types is an instance type.

Parameters:
aType - (required).

getInstanceType

public IAnyType getInstanceType()
Gets the type that instances of this type have. In general a type is also its instance type. In case of union types the instance type is the most specific common base type of all member types of the union.

Returns:
(required).

setBaseType

public void setBaseType(IAnyType aType)
Sets the base type.

Parameters:
aType - (required).

getBaseType

public IAnyType getBaseType()
Gets the base type. Every type except the "anyType" has a base type.

Returns:
A type (optional).

isSimple

public boolean isSimple()
Checks if the type is a simple type. Complex types with simple content also return true.

Returns:
Returns true iff the type is a simple type.

isComplex

public boolean isComplex()
Checks if the type is a complex type. Complex type with simple content also return true.

Returns:
Returns true iff the type is a complex type.

isActive

public boolean isActive(FinalType aFinalType)
Checks if the specified final type is active.

Parameters:
aFinalType - (required).
Returns:
Returns true iff the specified final type is active.

isActive

public boolean isActive(BlockType aBlockType)
Checks if the specified block type is active.

Parameters:
aBlockType - (required).
Returns:
Returns true iff the specified block type is active.

isAbstract

public boolean isAbstract()
Checks if the type is abstract.

Returns:
Returns true iff the type is abstract.

getAttributesModel

public IAttributesModel getAttributesModel()
Gets the attributes model. Simple types return an empty attributes model.

Returns:
An attributes model. (required)

getContentModel

public IContentModel getContentModel()
Gets the content model. Simple types return a simple content model.

Returns:
A content model. (required)

getConstraints

public IConstraints getConstraints()
Gets the constraints imposed on this type.

Returns:
(required).

setConstraints

public void setConstraints(IConstraints aConstraints)
Sets the constraints.

Parameters:
aConstraints - (required).

createData

public IAnyTypeData createData(IDataImpl anImpl)
                        throws XmlException
Creates a data object for the specified data implementation. All local constraints that are imposed on the data object by this type are checked.

Parameters:
anImpl - (required).
Returns:
(required).
Throws:
XmlException - Raised iff the data object could not be created.

createUncheckedData

public IAnyTypeData createUncheckedData(IDataImpl anImpl)
                                 throws XmlException
Creates a data object for the specified data implementation. Only constraints that are inherent in the creation are checked (e.g. a number must not contain letters). Constraint that correspond to additionally applied facets are not checked.

Parameters:
anImpl - (required).
Returns:
(required).
Throws:
XmlException

createEmptyData

public IAnyTypeData createEmptyData(IDataImpl aDataImpl)
                             throws XmlException
Creates an empty data object for the specified implementation.

In general, the data implementation is not used while creating an empty data object. The created data object receives its implementation later when its setImpl method is called. The data implementation is passed to this method because in case of a union type the textual content of the implementation is used to decide which member type to instantiate.

The created data object has assigned its type.

Parameters:
aDataImpl - (required).
Returns:
(required).
Throws:
XmlException

getSimpleContentType

public ISimpleType getSimpleContentType()
Gets the type of the simple content. If this type is a simple type then this type itself is returned. If this type is a complex type with simple content then the simple base type of this type is returned. If this type is a complex type with complex content then null is returned.

Returns:
(optional).

getSimpleStorageType

public java.lang.Class getSimpleStorageType()
Gets the simple storage type. The simple storage type is the Java type that is used to store the simple values of this type. A simple storage type can either be a primitive type (like int, boolean, float, ...) or a (simple) reference type (like String). Only non-complex types, i.e. atomic types, list types, union types, and restrictions of them have a simple storage type. In particular, complex types with simple content also return null.

Returns:
(optional).

checkConstraints

public void checkConstraints(ICheckContext aContext)
Checks the constraints of this type.

Parameters:
aContext - (required).

checkEnclosedConstraints

public void checkEnclosedConstraints(ICheckContext aContext)
Checks the enclosed constraints. Depending on the type this method performs the following checks:

Parameters:
aContext - (required).

getRoleName

public java.lang.String getRoleName()
Gets the role name of the type. Only types that are anonymous have a role name. Examples of role names are "itemType" or "memberType0". Role names are unique in the context of the enclosing declaration of a type.

Returns:
(optional).

getDataCreator

public IDataCreator getDataCreator()
Gets the data creator. All types except abstract types and union types have a data creator.

Returns:
(optional).

setDataCreator

public void setDataCreator(IDataCreator aCreator)
Sets the data creator.

Parameters:
aCreator - (optional).

getXPathMethods

public java.util.Map getXPathMethods()
Gets the map of XPath methods that are available for this type.

Returns:
(required). A map that maps strings to #IXPathMethods.

getDirectSubtypes

public java.util.Collection getDirectSubtypes()
Gets the types that are direct subtypes of this type. This type itself is not included in the collection.

Returns:
(required). A collection of IAnyType.

getSubtypes

public java.util.Collection getSubtypes()
Recursively collects the subtypes of this type. This type itself is not included in the collection.

Returns:
(required). A collection of IAnyType.

addDirectSubtype

public void addDirectSubtype(IAnyType aType)
Adds a type to the collection of direct subtypes.

Parameters:
aType - (required).