Version: 1.1.1

org.biomoby.shared.data
Class MobyDataString

java.lang.Object
  extended by org.biomoby.shared.MobyData
      extended by org.biomoby.shared.MobyPrimaryData
          extended by org.biomoby.shared.MobyPrimaryDataSimple
              extended by org.biomoby.shared.data.MobyDataObject
                  extended by org.biomoby.shared.data.MobyDataString
All Implemented Interfaces:
Cloneable, Comparable, MobyDataInstance

public class MobyDataString
extends MobyDataObject

A class representing a MOBY String primitive. Internally, the value is stored in a StringBuffer. Because getObject() will return a mutable StringBuffer, you can use its methods to modify the underlying value of this MOBY object.


Field Summary
 
Fields inherited from interface org.biomoby.shared.data.MobyDataInstance
CENTRAL_XML_MODE, SERVICE_XML_MODE
 
Constructor Summary
MobyDataString(CharSequence stringValue)
           
MobyDataString(CharSequence stringValue, Registry registry)
           
MobyDataString(Element element)
          Construct the object using a DOM fragment.
MobyDataString(Element element, Registry registry)
           
MobyDataString(String articleName, CharSequence stringValue)
          Constructor to build a MOBY base String object from a CharSequence (i.e.
MobyDataString(String articleName, CharSequence stringValue, Registry registry)
           
 
Method Summary
 MobyDataString clone()
          Simply calls new constructor with object's existing data type, name and value.
 Object getObject()
          Gives access to the Java object instance underlying the MobyData instance.
 String getValue()
          A lexical (prefereably human readable) representation of the underlying object value (not including the namespace and ID).
 void setValue(CharSequence str)
           
 String toString()
          Convenience method to get the basic XML representation
 String toXML()
          This method sanitizes strings of XML escape characters such as the ampersand (&) and the less-than sign (<).
 
Methods inherited from class org.biomoby.shared.data.MobyDataObject
addCrossReference, addCrossReferences, addCrossReferences, addProvisionInfo, compareTo, createInstanceFromDOM, createInstanceFromDOM, createInstanceFromString, createInstanceFromString, createInstanceFromXML, equals, getCrossReferences, getId, getName, getPrimaryNamespace, getProvisionInfo, getTextContents, getXmlMode, hasCrossReferences, setId, setName, setPrimaryNamespace, setProvisionInfo, setXmlMode
 
Methods inherited from class org.biomoby.shared.MobyPrimaryDataSimple
addNamespace, format, getDataType, getNamespaces, removeNamespace, removeNamespace, setDataType, setNamespaces
 
Methods inherited from class org.biomoby.shared.MobyPrimaryData
isPrimary
 
Methods inherited from class org.biomoby.shared.MobyData
getId, getName, getUserData, setUserData
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.biomoby.shared.data.MobyDataInstance
getName, getUserData, setUserData
 

Constructor Detail

MobyDataString

public MobyDataString(Element element)
               throws IllegalArgumentException
Construct the object using a DOM fragment.

Throws:
IllegalArgumentException - if the element is not a String tag

MobyDataString

public MobyDataString(Element element,
                      Registry registry)
               throws IllegalArgumentException
Throws:
IllegalArgumentException

MobyDataString

public MobyDataString(String articleName,
                      CharSequence stringValue)
Constructor to build a MOBY base String object from a CharSequence (i.e. String, StringBuffer, CharBuffer or StringBuilder).


MobyDataString

public MobyDataString(String articleName,
                      CharSequence stringValue,
                      Registry registry)

MobyDataString

public MobyDataString(CharSequence stringValue)

MobyDataString

public MobyDataString(CharSequence stringValue,
                      Registry registry)
Method Detail

toString

public String toString()
Description copied from class: MobyDataObject
Convenience method to get the basic XML representation

Overrides:
toString in class MobyDataObject
Returns:
the raw XML representation of the object

clone

public MobyDataString clone()
Description copied from class: MobyDataObject
Simply calls new constructor with object's existing data type, name and value. Subclasses should override this method if more datafields need to be copied for an accurate clone of the Moby Data Instance (i.e. anything but a base object). The subclasses should ensure that they also return a MobyDataObject.

Overrides:
clone in class MobyDataObject
Returns:
an object of class MobyDataObject

getObject

public Object getObject()
Description copied from class: MobyDataObject
Gives access to the Java object instance underlying the MobyData instance. For example, to change a MOBY String object, call ((StringBuffer) (data.getObject()).append("extra text to add to the end") In the case of a base Moby Object, there really is no underlying Java equivalent to return, so a java.lang.Object is returned for completeness's sake. possibly useful for notification events and pointer equivalency testing in derived classes such as MobyDataServiceAssocInstance?

Specified by:
getObject in interface MobyDataInstance
Overrides:
getObject in class MobyDataObject
Returns:
a StringBuffer (i.e. the value is editable)

getValue

public String getValue()
Description copied from class: MobyDataObject
A lexical (prefereably human readable) representation of the underlying object value (not including the namespace and ID). This value is used in sorting, and potentially for user interface elements such as tool tips and comment fields. For base objects, there is no underlying value (just a namespace and id), so the result is always a constant string "[Object]".

Overrides:
getValue in class MobyDataObject

setValue

public void setValue(CharSequence str)

toXML

public String toXML()
This method sanitizes strings of XML escape characters such as the ampersand (&) and the less-than sign (<). WARNING: this method will not escape ampersand in the string "&amp;", or '&#x26;' style character references. We will assume that is this case you've probably already written the string as XML. Also note that null strings are treated as empty strings. WARNING: As of yet, we do not deal with the false escaping of strings containg already-escaped CDATA sections!

Specified by:
toXML in interface MobyDataInstance
Overrides:
toXML in class MobyDataObject
Returns:
the MOBY XML representation of the data instance

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010