IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.base
Class TimeFormat

java.lang.Object
  extended by com.ibm.btt.base.FormatElement
      extended by com.ibm.btt.base.FieldFormat
          extended by com.ibm.btt.base.TimeFormat
All Implemented Interfaces:
Cacheable, java.io.Externalizable, java.io.Serializable

This class formats a Date as a String conforming to its attributes.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ibm.btt.base.FormatElement
dataElementName, externalizer, name
 
Constructor Summary
TimeFormat()
          
Method Summary
 java.lang.String[] extract(java.lang.String aString)
          
Methods inherited from class com.ibm.btt.base.FieldFormat
format, format, toStrings, unformat, unformat
 
Methods inherited from class com.ibm.btt.base.FormatElement
checkIndexes, exceptionInfo, externalizer, getDataElementName, getExternalizer, getName, getTagName, isCacheable, isConstant, isItConstant, isNull, readExternal, readExternal, readObject, reinitialize, removeExternal, rootDecorated, setDataElementName, setExternalizer, setName, setSize, toTags, unformat, writeExternal, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeFormat

public TimeFormat()
This is the default constructor used to create a TimeFormat object.


TimeFormat

public TimeFormat(java.lang.String aName)
           throws java.io.IOException
This is the constructor used by the externalizer to create a TimeFormat object.

Parameters:
aName - java.lang.String
Throws:
java.io.IOException
Method Detail

extract

public java.lang.String[] extract(java.lang.String aString)
Extracts a String whose length is the expected length.

Overrides:
extract in class FormatElement
Parameters:
aString - String
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 its parameters.

Specified by:
formatField in class FieldFormat
Parameters:
aDataField - DataField
Returns:
String
Throws:
DSEInvalidClassException

getAmPmStrings

protected java.lang.String[] getAmPmStrings()
Returns an array containing the am and pm String for the formatter.

Returns:
java.lang.String[]

getAMString

public java.lang.String getAMString()
Returns the value of amString.

Returns:
java.lang.String

getHours24

public boolean getHours24()
Returns true if the formatter formats according to a 24 hour clock, or false if it formats according to a 12 hour clock.

Returns:
boolean

getPattern

protected java.lang.String getPattern()
Returns the pattern used when initializing the SimpleDateFormat. The pattern is obtained from the parameters of the class.

Returns:
java.lang.String

getPMString

public java.lang.String getPMString()
Returns the value of pmString.

Returns:
java.lang.String

getSeparator

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

Returns:
char

getShowSeconds

public boolean getShowSeconds()
Returns true if the formatted String shows the seconds, or false if it does not.

Returns:
boolean

getUseSeparator

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

Returns:
boolean

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException
Initializes a TimeFormat with the aTag attributes.

Specified by:
initializeFrom in class FormatElement
Parameters:
aTag - com.ibm.btt.base.Tag
Returns:
Object
Throws:
java.io.IOException

setAMString

public void setAMString(java.lang.String aString)
Sets the value of the amString.

Parameters:
aString - java.lang.String

setHours24

public void setHours24(boolean b)
Sets the hours24 attribute. This attribute is set to true if the formatter formats according to the 24 hour clock, and false if it formats according to the 12 hour clock.

Parameters:
b - boolean

setPMString

public void setPMString(java.lang.String aString)
Sets the value of the pmString.

Parameters:
aString - java.lang.String

setSeparator

public void setSeparator(java.lang.String aString)
Sets the String used as the separator.

Parameters:
aString - java.lang.String

setShowSeconds

public void setShowSeconds(boolean aBoolean)
Sets the value of the showSeconds attribute. This attribute is set to true if the formatted String shows the seconds, or false if it does not.

Parameters:
aBoolean - boolean

setUseSeparator

public void setUseSeparator(boolean aBoolean)
Sets the value of the useSeparator attribute. This attribute is set to true if the separator is shown.

Parameters:
aBoolean - boolean

toString

public java.lang.String toString()
Returns a visual representation of this format.

Overrides:
toString in class FormatElement
Returns:
java.lang.String

unformatField

public DataField unformatField(java.lang.String aString,
                               DataField aDataField)
                        throws DSEInvalidArgumentException
Unformats a String using the java.text.SimpleDatFormat class initialized with the declared parameters.

Specified by:
unformatField in class FieldFormat
Parameters:
aString - java.lang.String
aDataField - DataField
Returns:
DataField
Throws:
DSEInvalidArgumentException

unformat

public int unformat(int ndxFrom,
                    int ndxTo,
                    java.lang.String str,
                    DataElement aDataElement)
             throws DSEInvalidRequestException,
                    DSEInvalidArgumentException
The new unformat methods added to the FormatElement to minimize the instances created during the unfomat process that later will be collected by the garbage collector (GC).

Overrides:
unformat in class FieldFormat
Parameters:
ndxFrom - is the initial index
ndxTo - one is the final index
Throws:
DSEInvalidRequestException
DSEInvalidArgumentException

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2009