org.jbind.xml.instance.data
Class AbstractData

java.lang.Object
  extended byorg.jbind.xml.instance.data.AbstractData
All Implemented Interfaces:
IAnyTypeData
Direct Known Subclasses:
AbstractSimpleData, AnyTypeData

public abstract class AbstractData
extends java.lang.Object
implements IAnyTypeData

Base class for data objects.


Constructor Summary
AbstractData()
           
 
Method Summary
 void accept_(IDataVisitor aVisitor)
          Accepts a data visitor.
 void addReferencedData_(java.lang.String aKey, IAnyTypeData aData)
          Adds a data object that is referenced by this data object.
 IAnyTypeData createElement_(IElemRefOrDecl anElemRefOrDecl, IAnyType anOverloadingType, java.lang.String aTextContent)
          Generice method for creating an element.
 IAnyTypeData createElement_(java.lang.String aNamespace, java.lang.String aName, IAnyType anOverloadingType, java.lang.String aTextContent)
          Generice method for creating an element.
protected  IAnyTypeData createUncheckedAttributeData_(java.lang.String aNamespace, java.lang.String aName, ITextContentProvider aProvider)
          Creates unchecked data objects for attributes.
protected abstract  void doAcceptEnds_(IDataVisitor aVisitor)
           
protected abstract  void doAcceptStarts_(IDataVisitor aVisitor)
           
 boolean equals(java.lang.Object anObject)
          Checks either reference equality or value equality depending on the type of the data.
protected  IAnyTypeData fetchByXPath_(java.lang.String anXPathMethodName)
           
 IAnyTypeData getAttribute_(java.lang.String aNamespace, java.lang.String aName)
          Generic method for getting an attribute.
 IDataDesc getDataDesc_()
          Gets the description of the data.
protected  ISimpleData getFixed_()
           
 IDataImpl getImpl_()
          Gets the data implementation of the data object.
 IComplexData getParent_()
          Gets the parent data object.
 IElemRefOrDecl getSubstitutionHead_()
          Gets the element declaration of the substition head.
 IAnyType getType_()
          Gets the type of the data object.
 int hashCode()
          Calculates the hash code.
 boolean isDefault_()
          Checks if the data has a default value or if it has an explicitly assigned value.
 boolean isNil_()
          Indicates that the data is nil.
 java.util.Iterator iterAttributes_(java.lang.String aNamespace, java.lang.String aName)
          Generic method for iterating attributes.
 java.util.ListIterator iterElements_(java.lang.String aNamespace, java.lang.String aName)
          Generic method for iterating elements.
protected  java.util.ListIterator iterReferencedData_(java.lang.String aKey)
           
protected  IAnyTypeData newElementData_(java.lang.String aNamespace, java.lang.String aName, IAnyType anOverloadingType, ITextContentProvider aProvider)
           
protected  double numberByXPath_(java.lang.String anXPathMethodName)
           
protected  void removeAttributeData_(java.lang.String aNamespace, java.lang.String aName)
           
protected  java.util.Iterator selectByXPath_(java.lang.String anXPathMethodName)
           
 IAnyTypeData setAttribute_(java.lang.String aNamespace, java.lang.String aName, IAnyType anOverloadingType, java.lang.String aTextContent)
          Generic method for setting an attribute.
 void setDataDesc_(IDataDesc aDataDesc)
          Sets the data description.
 void setImpl_(IDataImpl anImpl)
          Sets the implementation of the data object.
 void setSubstitutionHead_(IElemRefOrDecl aDecl)
          Sets the substitution head.
 void setType_(IAnyType aType)
          Set the type of the data object.
protected  java.lang.String stringByXPath_(java.lang.String anXPathMethodName)
           
protected  boolean testByXPath_(java.lang.String anXPathMethodName)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jbind.xml.core.data.IAnyTypeData
acceptImpl_
 

Constructor Detail

AbstractData

public AbstractData()
Method Detail

getDataDesc_

public IDataDesc getDataDesc_()
Description copied from interface: IAnyTypeData
Gets the description of the data. All data objects that where created as instances of elements or attributes have a data description. The only data objects that do not have a data description are data objects that appear in a schema as default or fixed values or in facets.

Specified by:
getDataDesc_ in interface IAnyTypeData
Returns:
(optional). The data description that was used to create this data object.

setDataDesc_

public void setDataDesc_(IDataDesc aDataDesc)
Description copied from interface: IAnyTypeData
Sets the data description.

Specified by:
setDataDesc_ in interface IAnyTypeData
Parameters:
aDataDesc - (required).

getSubstitutionHead_

public IElemRefOrDecl getSubstitutionHead_()
Description copied from interface: IAnyTypeData
Gets the element declaration of the substition head. The data object has a substitution head iff it is an instance of an element that is a substitute. In this case the element declaration that allowed this element as a substitute is returned.

Specified by:
getSubstitutionHead_ in interface IAnyTypeData
Returns:
(optional).

setSubstitutionHead_

public void setSubstitutionHead_(IElemRefOrDecl aDecl)
Description copied from interface: IAnyTypeData
Sets the substitution head.

Specified by:
setSubstitutionHead_ in interface IAnyTypeData
Parameters:
aDecl - (required).

getFixed_

protected ISimpleData getFixed_()

getType_

public IAnyType getType_()
Description copied from interface: IAnyTypeData
Gets the type of the data object.

Specified by:
getType_ in interface IAnyTypeData
Returns:
(required).

setType_

public void setType_(IAnyType aType)
Description copied from interface: IAnyTypeData
Set the type of the data object.

Specified by:
setType_ in interface IAnyTypeData
Parameters:
aType - (required).

getImpl_

public IDataImpl getImpl_()
Description copied from interface: IAnyTypeData
Gets the data implementation of the data object.

Specified by:
getImpl_ in interface IAnyTypeData
Returns:
(required).

setImpl_

public final void setImpl_(IDataImpl anImpl)
Description copied from interface: IAnyTypeData
Sets the implementation of the data object.

Specified by:
setImpl_ in interface IAnyTypeData
Parameters:
anImpl - (required).

getAttribute_

public IAnyTypeData getAttribute_(java.lang.String aNamespace,
                                  java.lang.String aName)
Description copied from interface: IAnyTypeData
Generic method for getting an attribute. This method can be used to access attributes that are declared by an attribute wildcard.

Specified by:
getAttribute_ in interface IAnyTypeData
Parameters:
aNamespace - (required).
aName - (required).
Returns:
(optional).

iterAttributes_

public java.util.Iterator iterAttributes_(java.lang.String aNamespace,
                                          java.lang.String aName)
Description copied from interface: IAnyTypeData
Generic method for iterating attributes. This method can be used to access attributes that are declared by an attribute wildcard.

Specified by:
iterAttributes_ in interface IAnyTypeData
Parameters:
aNamespace - (optional). If no namespace is specified then attributes of all namespaces are returned.
aName - (optional). If no name is specified then attributes with arbitrary names are returned.
Returns:
(required). An iterator of IAnyTypeData objects corresponding to the specified namespace and name.

isDefault_

public final boolean isDefault_()
Description copied from interface: IAnyTypeData
Checks if the data has a default value or if it has an explicitly assigned value.

Specified by:
isDefault_ in interface IAnyTypeData
Returns:
Returns true iff the data has a default value.

isNil_

public final boolean isNil_()
Description copied from interface: IAnyTypeData
Indicates that the data is nil.

Specified by:
isNil_ in interface IAnyTypeData
Returns:
Returns true iff the data is nil.

accept_

public final void accept_(IDataVisitor aVisitor)
Description copied from interface: IAnyTypeData
Accepts a data visitor.

Specified by:
accept_ in interface IAnyTypeData
Parameters:
aVisitor - (required).

doAcceptStarts_

protected abstract void doAcceptStarts_(IDataVisitor aVisitor)

doAcceptEnds_

protected abstract void doAcceptEnds_(IDataVisitor aVisitor)

addReferencedData_

public void addReferencedData_(java.lang.String aKey,
                               IAnyTypeData aData)
Description copied from interface: IAnyTypeData
Adds a data object that is referenced by this data object.

Specified by:
addReferencedData_ in interface IAnyTypeData
Parameters:
aKey - (required). Identifies the reference constraint that referenced the data object.
aData - (required). The referenced data.

iterReferencedData_

protected java.util.ListIterator iterReferencedData_(java.lang.String aKey)

iterElements_

public java.util.ListIterator iterElements_(java.lang.String aNamespace,
                                            java.lang.String aName)
Description copied from interface: IAnyTypeData
Generic method for iterating elements. This method can be used to access elements that are declared by an element wildcard.

Specified by:
iterElements_ in interface IAnyTypeData
Parameters:
aNamespace - (optional). If no namespace is specified then elements of all namespaces are considered.
aName - (optional). If no name is specified then elements with arbitrary names are considered.
Returns:
(required). An iterator of IAnyTypeData objects corresponding to the specified namespace and name.

getParent_

public IComplexData getParent_()
Description copied from interface: IAnyTypeData
Gets the parent data object. If this data object is an attribute then the element data that owns this attribute is returned.

Specified by:
getParent_ in interface IAnyTypeData
Returns:
(optional) The enclosing or owning element.

createUncheckedAttributeData_

protected IAnyTypeData createUncheckedAttributeData_(java.lang.String aNamespace,
                                                     java.lang.String aName,
                                                     ITextContentProvider aProvider)
                                              throws XmlException
Creates unchecked data objects for attributes. This method is used by the generated data classes when an attribute is assigned a value. The assignement uses an unchecked data object into which an (already exisiting) simple storage value is set. By this procedure it is avoided that the assigned value is ever transformed into a string. This would be the case if the data object would be created using the createData method.

The supplied text content provider is used only if the textual content of the assigned value is really needed in the creation of the data object. This happens if a data object of a union type is created because an intelligent guess is made about which member type of the union to choose.

Parameters:
aNamespace - (required).
aName - (required).
Throws:
XmlException

setAttribute_

public IAnyTypeData setAttribute_(java.lang.String aNamespace,
                                  java.lang.String aName,
                                  IAnyType anOverloadingType,
                                  java.lang.String aTextContent)
                           throws XmlException
Description copied from interface: IAnyTypeData
Generic method for setting an attribute. This method can be used to set attributes that are declared by an attribute wildcard.

Specified by:
setAttribute_ in interface IAnyTypeData
Parameters:
aNamespace - (required).
aName - (required).
anOverloadingType - (optional). If no overloading type is specified then the declared attribute type is used. If the attribute to be set corresponds to an attribute wildcard then the anySimpleType is used.
aTextContent - (required).
Throws:
XmlException - Raised iff the attribute could not be set.

removeAttributeData_

protected void removeAttributeData_(java.lang.String aNamespace,
                                    java.lang.String aName)
                             throws XmlException
Throws:
XmlException

createElement_

public IAnyTypeData createElement_(java.lang.String aNamespace,
                                   java.lang.String aName,
                                   IAnyType anOverloadingType,
                                   java.lang.String aTextContent)
                            throws XmlException
Description copied from interface: IAnyTypeData
Generice method for creating an element. The created element is appended to the content. This method can be used to create elements that are declared by an element wildcard or that belong to the substitution group of an element. It is checked that the element to be created is allowed in the content model of the data object. Yet, the order of elements is not checked.

Specified by:
createElement_ in interface IAnyTypeData
Parameters:
aNamespace - (required).
aName - (required).
anOverloadingType - (optional). If no overloading type is specified then the declared element type is used. If the element to be created corresponds to an element wildcard then the anyType is used.
aTextContent - (optional). If the element type has a simple content model then the simple content parameter is required.
Returns:
(required).
Throws:
XmlException - Raised iff the element could not be created. Indicates that the element to be created is not allowed in the content model.

createElement_

public IAnyTypeData createElement_(IElemRefOrDecl anElemRefOrDecl,
                                   IAnyType anOverloadingType,
                                   java.lang.String aTextContent)
                            throws XmlException
Description copied from interface: IAnyTypeData
Generice method for creating an element. The created element is appended to the content. It is not checked if the supplied element reference or declaration is allowed in the content model of this data object.

Specified by:
createElement_ in interface IAnyTypeData
Parameters:
anOverloadingType - (optional). If no overloading type is specified then the declared element type is used. If the element to be created corresponds to an element wildcard then the anyType is used.
Returns:
(required).
Throws:
XmlException - Raised iff the element could not be created.

newElementData_

protected IAnyTypeData newElementData_(java.lang.String aNamespace,
                                       java.lang.String aName,
                                       IAnyType anOverloadingType,
                                       ITextContentProvider aProvider)
                                throws XmlException
Throws:
XmlException

selectByXPath_

protected java.util.Iterator selectByXPath_(java.lang.String anXPathMethodName)
                                     throws XmlException
Throws:
XmlException

fetchByXPath_

protected IAnyTypeData fetchByXPath_(java.lang.String anXPathMethodName)
                              throws XmlException
Throws:
XmlException

testByXPath_

protected boolean testByXPath_(java.lang.String anXPathMethodName)
                        throws XmlException
Throws:
XmlException

numberByXPath_

protected double numberByXPath_(java.lang.String anXPathMethodName)
                         throws XmlException
Throws:
XmlException

stringByXPath_

protected java.lang.String stringByXPath_(java.lang.String anXPathMethodName)
                                   throws XmlException
Throws:
XmlException

equals

public final boolean equals(java.lang.Object anObject)
Description copied from interface: IAnyTypeData
Checks either reference equality or value equality depending on the type of the data. For complex data objects reference equality is checked whereas for non-complex data objects value equality is checked. Complex data objects with simple content are considered as complex data, i.e. reference equality is checked.

Specified by:
equals in interface IAnyTypeData

hashCode

public final int hashCode()
Description copied from interface: IAnyTypeData
Calculates the hash code. The hash code is either based on the object identity or on the value depending on the type of the data. Complex data objects (with simple or complex content) use the Object.hashCode() method whereas non-complex data objects calculate a value based hash code.

Specified by:
hashCode in interface IAnyTypeData