|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.biomoby.shared.MobyData org.biomoby.shared.MobyPrimaryData org.biomoby.shared.MobyPrimaryDataSimple org.biomoby.shared.data.MobyDataObject
public class MobyDataObject
A class representing a base MOBY object (i.e. just a namespace and id) that has been instantiated. If you are looking to represent an object with members (e.g. DNASequence), look at MobyDataComposite. If you are looking to represent a MOBY primitive object, please see the appropriate subclass of this class (e.g. MobyDataInteger). This class provides methods to instantiate the object value either simply using an ID (in which case an Object tag is created automatically), or via XML input either from a DOM Element (preferred) or a string containing the XML. The toXML method will return either service call or search template formatted XML depending on the mode set. Having both modes is useful because the data instance created from a previous call can be passed to a service search template by switching the XML mode. By default the object is in MobyDataInstance.SERVICE_XML_MODE.
Field Summary |
---|
Fields inherited from interface org.biomoby.shared.data.MobyDataInstance |
---|
CENTRAL_XML_MODE, SERVICE_XML_MODE |
Constructor Summary | |
---|---|
MobyDataObject(Element element)
Construct the object using a DOM fragment. |
|
MobyDataObject(Element element,
Registry registry)
|
|
MobyDataObject(MobyDataObject mobj)
Creates a base object with the same name, namespace and id as the input instance, as opposed to clone, which creates an exact copy of all the fields and the datatype. |
|
MobyDataObject(String name)
Constructor with no instance information, just a name (which can be blank). |
|
MobyDataObject(String name,
Registry registry)
|
|
MobyDataObject(String namespace,
String id)
Constructor convenient for a base object with a namespace and ID. |
|
MobyDataObject(String namespace,
String id,
Registry registry)
|
Method Summary | |
---|---|
void |
addCrossReference(MobyDataObject mdsi)
|
void |
addCrossReferences(Element e)
|
void |
addCrossReferences(Element e,
Registry reg)
|
void |
addProvisionInfo(Element e)
|
MobyDataObject |
clone()
Simply calls new constructor with object's existing data type, name and value. |
int |
compareTo(Object o)
This method lexically compares in the order of value, ID, name if passed in object is a MobyDataObject. |
static MobyDataInstance |
createInstanceFromDOM(Element objectTag)
This method creates a MobyDataObject of the appropriate subclass for a given input XML tree (e.g. base objects like MobyDataObject and MobyDataInt, or complex objects like MobyDataDateTime or MobyDataComposite, or even a MobyDataSecondaryInstance). |
static MobyDataInstance |
createInstanceFromDOM(Element objectTag,
Registry registry)
|
static MobyDataObject |
createInstanceFromString(String typeName,
String value)
Construct a primitive data type instance from a string value. |
static MobyDataObject |
createInstanceFromString(String typeName,
String value,
Registry registry)
|
static MobyDataInstance |
createInstanceFromXML(String mobyXML)
Similar to createObjectFromDOM(), but parses the XML for you using the JAXP parser discovery mechanism. |
boolean |
equals(Object passedInObject)
Used to see if two objects are equivalent. |
Collection |
getCrossReferences()
Call this method if you would like to modify the cross references, such as removing items, clearing the collection, etc. |
static String |
getId(Element e)
|
static String |
getName(Element e)
Determine the name of the element if an enclosing tag (e.g. |
Object |
getObject()
Gives access to the Java object instance underlying the MobyData instance. |
MobyNamespace |
getPrimaryNamespace()
|
MobyProvisionInfo |
getProvisionInfo()
|
static String |
getTextContents(Element element)
Similar to DOM level 3 getTextContent, but only elements are excepted as input, and text inside children elements is not picked up. |
String |
getValue()
A lexical (prefereably human readable) representation of the underlying object value (not including the namespace and ID). |
int |
getXmlMode()
Report whether toXML will produce Central template or service call instance XML. |
boolean |
hasCrossReferences()
|
void |
setId(String value)
Used to set the data instance value based on an ID string. i.e. just an Object. |
void |
setName(String name)
Please note that you almost never want to call this method in a client. |
void |
setPrimaryNamespace(MobyNamespace ns)
This sets the namespace that will be used in toXML(), since in the XML representation for service execution, you can only have one namespace. |
void |
setProvisionInfo(MobyProvisionInfo info)
|
void |
setXmlMode(int mode)
Determined whether toXML will return a Central template value or a service call instance value. |
String |
toString()
Convenience method to get the basic XML representation |
String |
toXML()
Produces a full-blown XML fragment that depending on the value of getXmlMode() is either a template for use in MOBY Central services, or a Simple element for use in calling a service instance. |
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 |
---|
public MobyDataObject(Element element) throws MobyException
MobyException
- if the element is not an Object tag, or is missing a required attributepublic MobyDataObject(Element element, Registry registry) throws MobyException
MobyException
public MobyDataObject(String name)
public MobyDataObject(String name, Registry registry)
public MobyDataObject(String namespace, String id)
public MobyDataObject(String namespace, String id, Registry registry)
public MobyDataObject(MobyDataObject mobj)
Method Detail |
---|
public static MobyDataObject createInstanceFromString(String typeName, String value) throws MobyException
MobyException
- if the requested datatype is not a primtive, or the value could not be used for that data type (e.g an integer out of the string "Bar")public static MobyDataObject createInstanceFromString(String typeName, String value, Registry registry) throws MobyException
MobyException
public static MobyDataInstance createInstanceFromDOM(Element objectTag) throws MobyException
objectTag
- the W3C DOM Element node corresponding to the object's enclosing tag, or a Simple tag
MobyException
public static MobyDataInstance createInstanceFromDOM(Element objectTag, Registry registry) throws MobyException
MobyException
public void setName(String name)
setName
in interface MobyDataInstance
setName
in class MobyData
public static String getTextContents(Element element)
public static String getName(Element e)
public static String getId(Element e)
public static MobyDataInstance createInstanceFromXML(String mobyXML) throws IllegalArgumentException
IllegalArgumentException
public boolean equals(Object passedInObject) throws ClassCastException
equals
in class Object
ClassCastException
- if and only if a child class or underlying Java object decides the comparison classes are invalidpublic int compareTo(Object o)
compareTo
in interface Comparable
public void setXmlMode(int mode) throws IllegalArgumentException
setXmlMode
in interface MobyDataInstance
mode
- one of MobyDataInstance.CENTRAL_XML_MODE or MobyDataInstance.SERVICE_XML_MODE
IllegalArgumentException
- if the mode is not one of the specified valuespublic int getXmlMode()
getXmlMode
in interface MobyDataInstance
public Object getObject()
getObject
in interface MobyDataInstance
public String getValue()
public void addCrossReferences(Element e) throws MobyException
MobyException
public void addCrossReferences(Element e, Registry reg) throws MobyException
MobyException
public void addCrossReference(MobyDataObject mdsi) throws NullPointerException
NullPointerException
public Collection getCrossReferences()
public boolean hasCrossReferences()
public void addProvisionInfo(Element e) throws MobyException
MobyException
public void setProvisionInfo(MobyProvisionInfo info)
public MobyProvisionInfo getProvisionInfo()
public void setId(String value)
setId
in class MobyData
public String toString()
toString
in class MobyPrimaryDataSimple
public MobyDataObject clone()
clone
in class MobyPrimaryDataSimple
public void setPrimaryNamespace(MobyNamespace ns)
public MobyNamespace getPrimaryNamespace()
public String toXML()
toXML
in interface MobyDataInstance
toXML
in class MobyPrimaryDataSimple
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |