com.edustructures.sifworks
Class SimpleField<T>

java.lang.Object
  extended by com.edustructures.sifworks.Element
      extended by com.edustructures.sifworks.SimpleField<T>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class SimpleField<T>
extends Element

A simple field value. Unlike complex elements, which are stored as child objects of their parent, simple fields (i.e. attributes or elements that have no children) are wrapped in a SimpleField instance and stored in the field table of their parent object.

Version:
1.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.edustructures.sifworks.Element
CURRENT_SERIALIZE_VERSION
 
Constructor Summary
SimpleField(SIFElement parent, ElementDef def, SIFSimpleType<T> value)
           
 
Method Summary
 java.lang.Object clone()
           
 SIFSimpleType<T> getSIFValue()
          Returns the SIFSimpleType value of this field
 java.lang.String getTextValue()
          Gets the text value of this element if applicable.
 java.lang.String getTextValue(SIFFormatter formatter)
           
 T getValue()
          Returns the native datatype value of this field
 boolean isDoNotEncode()
          Checks the underlying data type and flags to determine if XML encoding should be turned off for this field
 void setSIFValue(SIFSimpleType value)
          Sets the SIF strongly-typed value of this element
 void setTextValue(java.lang.String value)
          Sets the datatype of this field as a string value.
 void setTextValue(java.lang.String value, SIFFormatter formatter)
           
 
Methods inherited from class com.edustructures.sifworks.Element
compareTo, getElementDef, getParent, getRoot, isChanged, isEmpty, setChanged, setChanged, setDoNotEncode, setElementDef, setEmpty, setEmpty, setParent, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleField

public SimpleField(SIFElement parent,
                   ElementDef def,
                   SIFSimpleType<T> value)
Parameters:
parent - The SIFElement that is the parent of this field
def - The metadata definition of this field
value - A typed subclass of SIFSimpleType
Method Detail

getTextValue

public java.lang.String getTextValue(SIFFormatter formatter)

setTextValue

public void setTextValue(java.lang.String value,
                         SIFFormatter formatter)
                  throws ADKParsingException
Parameters:
value -
formatter -
Throws:
ADKParsingException

getTextValue

public java.lang.String getTextValue()
Description copied from class: Element
Gets the text value of this element if applicable. The default format of the text value is the SIF 1.x format

To change the format used for Text values on elements, set the ADK.setTextFormatter(SIFFormatter) property

Specified by:
getTextValue in class Element
Returns:
The text value of this element

setTextValue

public void setTextValue(java.lang.String value)
Sets the datatype of this field as a string value. The string is parsed using the default SIF formatter, which is the SIF 1.x formatter by default

Specified by:
setTextValue in class Element
Parameters:
value - The text value of this element
Throws:
java.lang.NumberFormatException - if the value being set cannot be parsed into the datatype being stored for this field
See Also:
Element.setTextValue(java.lang.String)

setSIFValue

public void setSIFValue(SIFSimpleType value)
Description copied from class: Element
Sets the SIF strongly-typed value of this element

Specified by:
setSIFValue in class Element
Parameters:
value - The SIF Value to set

getSIFValue

public SIFSimpleType<T> getSIFValue()
Returns the SIFSimpleType value of this field

Specified by:
getSIFValue in class Element
Returns:
the SIFSimpleType value of this field
See Also:
Element.getSIFValue()

getValue

public T getValue()
Returns the native datatype value of this field

Returns:
the native datatype value of this field

isDoNotEncode

public boolean isDoNotEncode()
Checks the underlying data type and flags to determine if XML encoding should be turned off for this field

Overrides:
isDoNotEncode in class Element
Returns:
true if automatic XML Encoding is disabled for this element; false if enabled (the default)
See Also:
Element.isDoNotEncode()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.