fi.hut.tml.xsmiles.mlfc.xforms.data
Class DData

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.xforms.data.DData
All Implemented Interfaces:
Data
Direct Known Subclasses:
DBoolean, DDate, DDecimal

public abstract class DData
extends java.lang.Object
implements Data

This class encapsulates the handling of invalid values, otherwise the subclasses will handle all conversion


Field Summary
protected  short datatype
           
 
Constructor Summary
DData(short dtype)
           
 
Method Summary
protected abstract  void clearValue()
          instructs subclass to set value to null, this is used for invalid values
 short getDataType()
           
 java.lang.String getInvalidValue()
          get the invalid value as a string
 boolean isValid()
          is the current value valid according to the datatype
 void setInvalidString(java.lang.String s)
          set the invalid value as a string
 void setValid(boolean v)
          set the validity status
 void setValueFromDisplay(java.lang.String displayValue)
          set the value from a display string
protected abstract  boolean setValueFromDisplayInternal(java.lang.String displayValue)
          internal method for setting the value from a display string
 void setValueFromObject(java.lang.Object obj)
          set the value as a Java Object
protected abstract  void setValueFromObjectInternal(java.lang.Object obj)
          internal method for setting the value as a Java Object
 void setValueFromSchema(java.lang.String displayValue)
          set the value from a Schema string
protected abstract  void setValueFromSchemaInternal(java.lang.String displayValue)
          internal method for setting the value from a Schema string
 java.lang.String toDisplayValue()
          get the display value (e.g.
protected abstract  java.lang.String toDisplayValueInternal()
          get the display value (e.g.
 java.lang.Object toObject()
          get the java object corresponding to the value
protected abstract  java.lang.Object toObjectInternal()
          get the java object corresponding to the value
 java.lang.String toSchemaString()
          get a schema compatible string from this data.
protected abstract  java.lang.String toSchemaStringInternal()
          get a schema compatible string from this data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

datatype

protected short datatype
Constructor Detail

DData

public DData(short dtype)
Method Detail

getDataType

public short getDataType()
Specified by:
getDataType in interface Data

isValid

public boolean isValid()
is the current value valid according to the datatype

Specified by:
isValid in interface Data

getInvalidValue

public java.lang.String getInvalidValue()
get the invalid value as a string

Specified by:
getInvalidValue in interface Data

setValid

public void setValid(boolean v)
set the validity status

Specified by:
setValid in interface Data

setInvalidString

public void setInvalidString(java.lang.String s)
Description copied from interface: Data
set the invalid value as a string

Specified by:
setInvalidString in interface Data

toDisplayValue

public final java.lang.String toDisplayValue()
get the display value (e.g. 3,12 / 3.12 depending on the locale)

Specified by:
toDisplayValue in interface Data

toSchemaString

public java.lang.String toSchemaString()
get a schema compatible string from this data. E.g. From a date you would get a String in xsd:date format

Specified by:
toSchemaString in interface Data

toObject

public java.lang.Object toObject()
get the java object corresponding to the value

Specified by:
toObject in interface Data

setValueFromObject

public final void setValueFromObject(java.lang.Object obj)
set the value as a Java Object

Specified by:
setValueFromObject in interface Data

setValueFromDisplay

public final void setValueFromDisplay(java.lang.String displayValue)
set the value from a display string

Specified by:
setValueFromDisplay in interface Data

setValueFromSchema

public final void setValueFromSchema(java.lang.String displayValue)
set the value from a Schema string

Specified by:
setValueFromSchema in interface Data

clearValue

protected abstract void clearValue()
instructs subclass to set value to null, this is used for invalid values


toDisplayValueInternal

protected abstract java.lang.String toDisplayValueInternal()
get the display value (e.g. 3,12 / 3.12 depending on the locale)


setValueFromObjectInternal

protected abstract void setValueFromObjectInternal(java.lang.Object obj)
internal method for setting the value as a Java Object


setValueFromDisplayInternal

protected abstract boolean setValueFromDisplayInternal(java.lang.String displayValue)
internal method for setting the value from a display string


setValueFromSchemaInternal

protected abstract void setValueFromSchemaInternal(java.lang.String displayValue)
internal method for setting the value from a Schema string


toSchemaStringInternal

protected abstract java.lang.String toSchemaStringInternal()
get a schema compatible string from this data. E.g. From a date you would get a String in xsd:date format


toObjectInternal

protected abstract java.lang.Object toObjectInternal()
get the java object corresponding to the value



X-Smiles 1.2