Version: 1.1.1

org.biomoby.shared.data
Class MobyDataSecondaryInstance

java.lang.Object
  extended by org.biomoby.shared.MobyData
      extended by org.biomoby.shared.MobySecondaryData
          extended by org.biomoby.shared.data.MobyDataSecondaryInstance
All Implemented Interfaces:
Cloneable, Comparable, MobyDataInstance

public class MobyDataSecondaryInstance
extends MobySecondaryData
implements MobyDataInstance, Comparable

A class that holds and displays secondary input data to a service.


Field Summary
static String ELEMENT_NAME
           
static String VALUE_NAME
           
 
Fields inherited from class org.biomoby.shared.MobySecondaryData
BOOLEAN_TYPE, DATETIME_TYPE, FLOAT_TYPE, INTEGER_TYPE, STRING_TYPE
 
Fields inherited from interface org.biomoby.shared.data.MobyDataInstance
CENTRAL_XML_MODE, SERVICE_XML_MODE
 
Constructor Summary
MobyDataSecondaryInstance(Element objectTag)
          Create an instance from XML input.
MobyDataSecondaryInstance(MobySecondaryData type)
          Basically clones the input parameter, and sets the value to the default value.
MobyDataSecondaryInstance(MobySecondaryData type, String value)
           
 
Method Summary
 boolean asBoolean()
           
 GregorianCalendar asDateTime()
           
 BigDecimal asFloat()
           
 BigInteger asInteger()
           
 String asString()
           
 int compareTo(Object o)
          This method lexically compares in the order of value, ID, name if passed in object is a MobyDataObject.
 Object getObject()
          For now, all secondary parameters are treated as strings.
 String getValue()
           
 int getXmlMode()
          Report whether toXML will produce Central template or service call instance XML.
 void setValue(String value)
           
 void setXmlMode(int mode)
          Determined whether toXML will return a Central template value or a service call instance value.
 String toXML()
          This method sanitizes parameter data value strings of XML escape characters such as the ampersand (&) and the less-than sign (<).
 
Methods inherited from class org.biomoby.shared.MobySecondaryData
addAllowedValue, clone, format, getAllowedValues, getDataType, getDefaultValue, getDescription, getLSID, getMaximumValue, getMaxValue, getMinimumValue, getMinValue, isPrimary, setAllowedValues, setDataType, setDefaultValue, setDescription, setMaximumValue, setMaxValue, setMinimumValue, setMinValue, toString
 
Methods inherited from class org.biomoby.shared.MobyData
getId, getName, getUserData, setId, setName, setUserData
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.biomoby.shared.data.MobyDataInstance
getName, getUserData, setName, setUserData
 

Field Detail

ELEMENT_NAME

public static final String ELEMENT_NAME
See Also:
Constant Field Values

VALUE_NAME

public static final String VALUE_NAME
See Also:
Constant Field Values
Constructor Detail

MobyDataSecondaryInstance

public MobyDataSecondaryInstance(MobySecondaryData type,
                                 String value)

MobyDataSecondaryInstance

public MobyDataSecondaryInstance(MobySecondaryData type)
Basically clones the input parameter, and sets the value to the default value.


MobyDataSecondaryInstance

public MobyDataSecondaryInstance(Element objectTag)
                          throws MobyException
Create an instance from XML input. Unfortunately, under the current scheme we have no way of knowing what the type of the parameter is (int, string, etc.). By default we will treat it as a string, as this is the most lenient.

Throws:
MobyException
Method Detail

asBoolean

public boolean asBoolean()

asFloat

public BigDecimal asFloat()

asInteger

public BigInteger asInteger()

asString

public String asString()

asDateTime

public GregorianCalendar asDateTime()

getObject

public Object getObject()
For now, all secondary parameters are treated as strings.

Specified by:
getObject in interface MobyDataInstance

setValue

public void setValue(String value)
              throws IllegalArgumentException
Throws:
IllegalArgumentException

getValue

public String getValue()

setXmlMode

public void setXmlMode(int mode)
                throws IllegalArgumentException
Description copied from interface: MobyDataInstance
Determined whether toXML will return a Central template value or a service call instance value.

Specified by:
setXmlMode in interface MobyDataInstance
Parameters:
mode - one of CENTRAL_XML_MODE or SERVICE_XML_MODE
Throws:
IllegalArgumentException - if the mode is not one of the specified values

getXmlMode

public int getXmlMode()
Report whether toXML will produce Central template or service call instance XML.

Specified by:
getXmlMode in interface MobyDataInstance
Returns:
one of CENTRAL_XML_MODE or SERVICE_XML_MODE

toXML

public String toXML()
This method sanitizes parameter data value 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 MobySecondaryData

compareTo

public int compareTo(Object o)
This method lexically compares in the order of value, ID, name if passed in object is a MobyDataObject. Otherwise it returns -1 (null fields get pushed to the end of the list). Child classes are encouraged to override this method for numerical comparison, etc. where appropriate, falling back to this method if the result is 0.

Specified by:
compareTo in interface Comparable

Version: 1.1.1

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