org.jbind.xml.instance.data
Class StringDataImpl

java.lang.Object
  extended byorg.jbind.xml.instance.data.StringDataImpl
All Implemented Interfaces:
IDataImpl, IHasLocation, IImpl, IImplChild, IImplWithText

public class StringDataImpl
extends java.lang.Object
implements IDataImpl


Constructor Summary
StringDataImpl(java.lang.String aString, java.util.Map aPrefixToNamespaceMapping, IHasLocation aHasLocation)
           
 
Method Summary
 void accept(IDataImplVisitor aVisitor)
           
 IAnyTypeData getAttributeData(java.lang.String aNamespace, java.lang.String aLocalName)
          Gets the data object of an attribute.
 IAnyTypeData getData()
           
 ILocation getLocation()
           
 java.lang.String getNamespace()
           
 IImplContainer getParentImpl()
           
 java.lang.String getPartName()
          Gets the attribute or element name.
 java.util.Map getPrefixToNamespaceMapping()
          Gets the prefix to namespace mapping.
 java.lang.String getTextContent()
          Gets the textual content.
 boolean hasTextContent()
          Checks if the implementation has textual content.
 boolean isDefault()
          Checks if the data implementation is a default value or if a value was assigned explicitly.
 boolean isNil()
          Indicates if the data implementation was assigned "nil".
 java.util.Iterator iterAttributes(java.lang.String aNamespace, java.lang.String aName)
          Iterates the attribute data objects for the specified namespace and name.
 java.util.ListIterator iterChildren()
          Iterates the children.
 java.util.ListIterator iterElementData(java.lang.String aNamespace, java.lang.String aLocalName)
          Iterates the data objects for the specified namespace and element name.
 void restoreTextContent(ITextContentMemento aMemento)
           
 ITextContentMemento saveTextContent()
           
 void setData(IAnyTypeData aData)
           
 void setTextContent(ITextContentProvider aTextContentProvider)
          Sets the textual content by specifiying a provider for lazy evaluation.
 void setTextContent(java.lang.String aString)
          Sets the textual content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringDataImpl

public StringDataImpl(java.lang.String aString,
                      java.util.Map aPrefixToNamespaceMapping,
                      IHasLocation aHasLocation)
Method Detail

getAttributeData

public IAnyTypeData getAttributeData(java.lang.String aNamespace,
                                     java.lang.String aLocalName)
Description copied from interface: IImpl
Gets the data object of an attribute.

Specified by:
getAttributeData in interface IImpl
Parameters:
aNamespace - (required).
aLocalName - (required).
Returns:
(optional).

getPrefixToNamespaceMapping

public java.util.Map getPrefixToNamespaceMapping()
Description copied from interface: IImpl
Gets the prefix to namespace mapping.

Specified by:
getPrefixToNamespaceMapping in interface IImpl
Returns:
(required).

getTextContent

public java.lang.String getTextContent()
Description copied from interface: IImplWithText
Gets the textual content. The textual content corresponds to the lexical value of a data object. For data implementations of attributes the string that is assigned to the attribute is returned. For data implementations of elements with simple content the string value that is assigned to the simple content is returned. If the simple content is empty then the empty string is returned.

Specified by:
getTextContent in interface IImplWithText
Returns:
(required).

setTextContent

public void setTextContent(java.lang.String aString)
Description copied from interface: IImplWithText
Sets the textual content. The textual content corresponds to the lexical value of a data object.

Specified by:
setTextContent in interface IImplWithText
Parameters:
aString - (required).

setTextContent

public void setTextContent(ITextContentProvider aTextContentProvider)
Description copied from interface: IImplWithText
Sets the textual content by specifiying a provider for lazy evaluation.

Specified by:
setTextContent in interface IImplWithText
Parameters:
aTextContentProvider - (required).

isDefault

public boolean isDefault()
Description copied from interface: IImplWithText
Checks if the data implementation is a default value or if a value was assigned explicitly.

Specified by:
isDefault in interface IImplWithText
Returns:
Returns true iff the data implementation is a default value.

isNil

public boolean isNil()
Description copied from interface: IImpl
Indicates if the data implementation was assigned "nil".

Specified by:
isNil in interface IImpl
Returns:
Returns true iff the data implementation was assigned "nil".

iterElementData

public java.util.ListIterator iterElementData(java.lang.String aNamespace,
                                              java.lang.String aLocalName)
Description copied from interface: IImpl
Iterates the data objects for the specified namespace and element name.

Specified by:
iterElementData in interface IImpl
Parameters:
aNamespace - (required).
aLocalName - (required).
Returns:
(required). An iterator of IAnyTypeData.

getLocation

public ILocation getLocation()
Specified by:
getLocation in interface IHasLocation

saveTextContent

public ITextContentMemento saveTextContent()
Specified by:
saveTextContent in interface IImplWithText

restoreTextContent

public void restoreTextContent(ITextContentMemento aMemento)
Specified by:
restoreTextContent in interface IImplWithText

hasTextContent

public boolean hasTextContent()
Description copied from interface: IImplWithText
Checks if the implementation has textual content. This method is used to decide if a default value should be used or not.

Attribute implementations will always return true because attributes take their default values only if they are not present in the instance.

Element implementation will return true iff their text content is null or equal to the empty string. In other words the default value of an element is used when the element is empty. (cf. the note at W3C XML-Schema-Structure specification section 3.1.1).

Specified by:
hasTextContent in interface IImplWithText
Returns:
Returns true iff there is textual content.

iterChildren

public java.util.ListIterator iterChildren()
Description copied from interface: IImpl
Iterates the children.

Specified by:
iterChildren in interface IImpl
Returns:
(required). A list iterator of IImpl.

accept

public void accept(IDataImplVisitor aVisitor)
Specified by:
accept in interface IImpl

getPartName

public java.lang.String getPartName()
Description copied from interface: IDataImpl
Gets the attribute or element name.

Specified by:
getPartName in interface IDataImpl
Returns:
(required).

getNamespace

public java.lang.String getNamespace()
Specified by:
getNamespace in interface IDataImpl

getData

public IAnyTypeData getData()
Specified by:
getData in interface IDataImpl

setData

public void setData(IAnyTypeData aData)
Specified by:
setData in interface IDataImpl

iterAttributes

public java.util.Iterator iterAttributes(java.lang.String aNamespace,
                                         java.lang.String aName)
Description copied from interface: IDataImpl
Iterates the attribute data objects for the specified namespace and name.

Specified by:
iterAttributes in interface IDataImpl
Parameters:
aNamespace - (optional).
aName - (optional).
Returns:
(required). An iterator of IAnyTypeData.

getParentImpl

public IImplContainer getParentImpl()
Specified by:
getParentImpl in interface IImplChild