com.ibm.dse.base
Class DateFormat

java.lang.Object
  |
  +--com.ibm.dse.base.FormatElement
        |
        +--com.ibm.dse.base.FieldFormat
              |
              +--com.ibm.dse.base.DateFormat

public class DateFormat
extends FieldFormat

This class formats a Date to a String following the conditions of its attributes.

See Also:
Serialized Form

Fields inherited from class com.ibm.dse.base.FormatElement
dataElementName, name
 
Constructor Summary
DateFormat()
          This constructor creates a DateFormat object.
DateFormat(java.lang.String aName)
          This constructor creates the DateFormat object with the id aName.
 
Method Summary
 java.lang.String[] extract(java.lang.String aString)
          Extracts a string which length is the length of the expected string.
 java.lang.String formatField(DataField aDataField)
          Formats a Date using the java.text.SimpleDatFormat class initialized with the declared parameters.
 boolean getFourDigitYear()
          Returns the value of fourDigitYear.
 int getOrdering()
          Returns the value of ordering.
 java.lang.String getPattern()
          Calculates the pattern that is used to initialize the SimpleDateFormat.
 java.lang.String getSeparator()
          Returns the value of separator.
 boolean getUseSeparator()
          Returns the value of useSeparator.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a DateFormat with the Tag attributes.
 void setFourDigitYear(boolean aBoolean)
          Sets the value of fourDigitYear.
 void setOrdering(int anInt)
          Sets the value of ordering.
 void setSeparator(java.lang.String aSeparator)
          Sets the value of separator.
 void setUseSeparator(boolean aBoolean)
          Sets the value of useSeparator.
 java.lang.String toString()
          Returns an SGML representation of this instance.
 DataField unformatField(java.lang.String aString, DataField aDataField)
          Unformats aString using the parse() method of java.text.SimpleDataFormat initialize using the parameters.
 
Methods inherited from class com.ibm.dse.base.FieldFormat
format, format, unformat, unformat
 
Methods inherited from class com.ibm.dse.base.FormatElement
exceptionInfo, externalizer, format, getDataElementName, getExternalizer, getName, getTagName, isCacheable, isConstant, readExternal, readExternal, readObject, reinitialize, removeExternal, rootDecorated, setDataElementName, setExternalizer, setName, setSize, toStrings, toTags, unformat, writeExternal, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateFormat

public DateFormat()
This constructor creates a DateFormat object.

DateFormat

public DateFormat(java.lang.String aName)
           throws java.io.IOException
This constructor creates the DateFormat object with the id aName.
Parameters:
aName - java.lang.String
Method Detail

extract

public java.lang.String[] extract(java.lang.String aString)
Extracts a string which length is the length of the expected string.
Overrides:
extract in class FormatElement
Returns:
java.lang.String[]

formatField

public java.lang.String formatField(DataField aDataField)
                             throws DSEInvalidClassException
Formats a Date using the java.text.SimpleDatFormat class initialized with the declared parameters.
Overrides:
formatField in class FieldFormat

getFourDigitYear

public boolean getFourDigitYear()
Returns the value of fourDigitYear.
Returns:
boolean

getOrdering

public int getOrdering()
Returns the value of ordering.
Returns:
int

getPattern

public java.lang.String getPattern()
Calculates the pattern that is used to initialize the SimpleDateFormat. It is calculated from the parameters of the class.
Returns:
java.lang.String

getSeparator

public java.lang.String getSeparator()
Returns the value of separator.
Returns:
java.lang.String

getUseSeparator

public boolean getUseSeparator()
Returns the value of useSeparator.
Returns:
boolean

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException
Initializes a DateFormat with the Tag attributes.
Overrides:
initializeFrom in class FormatElement
Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
java.lang.Object

setFourDigitYear

public void setFourDigitYear(boolean aBoolean)
Sets the value of fourDigitYear.
Parameters:
aBoolean - boolean

setOrdering

public void setOrdering(int anInt)
Sets the value of ordering.
Parameters:
anInt - int

setSeparator

public void setSeparator(java.lang.String aSeparator)
Sets the value of separator.
Parameters:
aChar - char

setUseSeparator

public void setUseSeparator(boolean aBoolean)
Sets the value of useSeparator.
Parameters:
aBoolean - boolean

toString

public java.lang.String toString()
Returns an SGML representation of this instance.
Overrides:
toString in class FormatElement
Returns:
java.lang.String

unformatField

public DataField unformatField(java.lang.String aString,
                               DataField aDataField)
                        throws DSEInvalidArgumentException
Unformats aString using the parse() method of java.text.SimpleDataFormat initialize using the parameters.
Overrides:
unformatField in class FieldFormat