IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.base
Class FormatElement

java.lang.Object
  extended by com.ibm.btt.base.FormatElement
All Implemented Interfaces:
Cacheable, java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
ConstantFormat, FieldFormat, FormatDecorator, IndexedCollectionFormat, KeyedCollectionFormat, LDAPRequestFormat, LDAPResponseFormat, MapFormat, TypedDataElementFormat

@ATTR(value="dataName#String#REQUIRED")
public abstract class FormatElement
extends java.lang.Object
implements Externalizable, Cacheable

This is the abstract parent class of the formats.

See Also:
Serialized Form

Field Summary
 java.lang.String dataElementName
          The name of the formatted data element.
(package private) static Externalizer externalizer
           
 java.lang.String name
          The identifier of the FormatElement instance.
protected  IXMLFormatSupport xmlSupport
           
 
Constructor Summary
FormatElement()
           
 
Method Summary
protected  void checkIndexes(int ndxFrom, int ndxTo, java.lang.String str)
          Check whether the ndxFrom and the ndxTo are valid
 java.lang.String exceptionInfo()
          Gets the class name.
 Externalizer externalizer()
          Returns the instance of the externalizer for this class.
 java.lang.String[] extract(java.lang.String aString)
          Extracts (strips) the substring corresponding to the format element from the input String and returns it and the remaining String as the elements of an array.
 java.lang.String format(Context aContext)
          Throws an Exception.
abstract  java.lang.String format(DataElement aDataElement)
          Format abstract class.
 java.lang.String getAttributeValueForXMLFormat(java.lang.String attrName)
           
 java.lang.String getDataElementName()
          Returns the value of dataElementName.
static Externalizer getExternalizer()
          Gets the Externalizer.
 java.lang.String getName()
          Returns the value of name.
 java.lang.String getTagName()
          Gets a tag name.
abstract  java.lang.Object initializeFrom(Tag aTag)
          Initializes a FormatElement with the Tag attributes.
 boolean isCacheable()
          This method finds out if THIS particular object can be cached.
 java.lang.Boolean isConstant()
          Returns false.
 boolean isItConstant()
          Returns false.
protected  boolean isNull(int ndxFrom, int ndxTo)
          Check whether the ndxFrom is equals to the ndxTo
 void readExternal()
          Initializes a data element with its external value.
 void readExternal(java.io.ObjectInput s)
          Invokes the object creation from an ObjectInput.
static java.lang.Object readObject(java.lang.String name)
          Instantiates a Format called "name" from the definitions file.
 void reinitialize()
          This method will reinitialize THIS object.
 void removeExternal()
          Removes the tags for this object from the definitions file.
 FormatElement rootDecorated()
          Returns this element.
 void setDataElementName(java.lang.String aDataElementName)
          Sets the value of dataElementName.
static void setExternalizer(Externalizer anExternalizer)
          Sets the Externalizer.
 void setName(java.lang.String aName)
          Returns the value of name.
 void setSize(int anInt)
          Does nothing.
 java.lang.String toString()
          Returns a visual representation of this format element.
 Vector toStrings()
          Returns a visual representation of this format element.
 Vector toTags()
          Returns a Vector with the FormatElement represented as a Tag.
 int unformat(int ndxFrom, int ndxTo, java.lang.String str, Context ctx)
          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).
 int unformat(int ndxFrom, int ndxTo, java.lang.String str, DataElement de)
          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).
 DataElement unformat(java.lang.String aString, Context aContext)
          Throws an Exception.
abstract  DataElement unformat(java.lang.String aString, DataElement aDataElement)
          Unformat abstract method.
 void writeExternal()
          Writes this instance converted in tags in a file.
 void writeExternal(java.io.ObjectOutput s)
          Provides concrete serialization handling for FormatElement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dataElementName

public java.lang.String dataElementName
The name of the formatted data element.


xmlSupport

protected IXMLFormatSupport xmlSupport

name

public java.lang.String name
The identifier of the FormatElement instance.


externalizer

static Externalizer externalizer
Constructor Detail

FormatElement

public FormatElement()
Method Detail

exceptionInfo

public java.lang.String exceptionInfo()
Gets the class name.

Returns:
String

getAttributeValueForXMLFormat

public java.lang.String getAttributeValueForXMLFormat(java.lang.String attrName)

externalizer

public Externalizer externalizer()
Returns the instance of the externalizer for this class.

Returns:
com.ibm.btt.base.Externalizer

extract

public java.lang.String[] extract(java.lang.String aString)
                           throws DSEInvalidArgumentException
Extracts (strips) the substring corresponding to the format element from the input String and returns it and the remaining String as the elements of an array. This method is called by the unformat() method of the collections formats such as RecordFormat and IndexedCollectionFormat. The default behavior is to accept the whole input String.

Parameters:
aString - String
Returns:
String[]
Throws:
DSEInvalidArgumentException

format

public java.lang.String format(Context aContext)
                        throws DSEInvalidClassException,
                               DSEInvalidRequestException,
                               DSEInvalidArgumentException
Throws an Exception. Only KeyedCollectionFormats can format a Context. This method is implemented for polymorphism.

Parameters:
aContext - com.ibm.btt.base.Context
Returns:
java.lang.String
Throws:
DSEInvalidClassException
DSEInvalidRequestException
DSEInvalidArgumentException

format

public abstract java.lang.String format(DataElement aDataElement)
                                 throws DSEInvalidClassException,
                                        DSEInvalidRequestException,
                                        DSEInvalidArgumentException
Format abstract class.

Parameters:
aDataElement - DataElement
Returns:
String
Throws:
DSEInvalidClassException
DSEInvalidRequestException
DSEInvalidArgumentException

getDataElementName

public java.lang.String getDataElementName()
Returns the value of dataElementName.

Returns:
java.lang.String

getExternalizer

public static Externalizer getExternalizer()
Gets the Externalizer.

Returns:
com.ibm.btt.base.Externalizer

getName

public java.lang.String getName()
Returns the value of name.

Specified by:
getName in interface Cacheable
Returns:
java.lang.String

getTagName

public java.lang.String getTagName()
Gets a tag name.

Returns:
java.lang.String

initializeFrom

public abstract java.lang.Object initializeFrom(Tag aTag)
                                         throws java.io.IOException,
                                                DSEException
Initializes a FormatElement with the Tag attributes.

Parameters:
aTag - com.ibm.btt.base.Tag
Returns:
data.DataElement
Throws:
java.io.IOException
DSEException

isCacheable

public boolean isCacheable()
This method finds out if THIS particular object can be cached.

Specified by:
isCacheable in interface Cacheable
Returns:
boolean

isConstant

public java.lang.Boolean isConstant()
Returns false. It is not a constant. It is recommended to use boolean isItConstant() instead of this method.

Returns:
Boolean

isItConstant

public boolean isItConstant()
Returns false. It is not a constant.

Returns:
Boolean

readExternal

public void readExternal()
                  throws java.io.IOException
Initializes a data element with its external value. To work properly, the data element must have an ID (name) and the Externalizer and its tagInputStream are initialized.

Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput s)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Invokes the object creation from an ObjectInput.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
s - java.io.ObjectInput
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readObject

public static java.lang.Object readObject(java.lang.String name)
                                   throws java.io.IOException
Instantiates a Format called "name" from the definitions file.

Parameters:
name - java.lang.String
Returns:
java.lang.Object
Throws:
java.io.IOException

reinitialize

public void reinitialize()
This method will reinitialize THIS object. It should be called immediately after being extracted from the cache.

Specified by:
reinitialize in interface Cacheable

removeExternal

public void removeExternal()
                    throws java.io.IOException
Removes the tags for this object from the definitions file.

Throws:
java.io.IOException

rootDecorated

public FormatElement rootDecorated()
Returns this element. It is implemented to provide polymorphism.


setDataElementName

public void setDataElementName(java.lang.String aDataElementName)
Sets the value of dataElementName.

Parameters:
aDataElementName - java.lang.String

setExternalizer

public static void setExternalizer(Externalizer anExternalizer)
Sets the Externalizer.

Parameters:
anExternalizer - com.ibm.btt.base.Externalizer

setName

public void setName(java.lang.String aName)
Returns the value of name.

Parameters:
aName - java.lang.String

setSize

public void setSize(int anInt)
Does nothing. Necessary to implement removeDecoration() on SelfLength

Parameters:
anInt - int

toString

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

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

toStrings

public Vector toStrings()
Returns a visual representation of this format element.

Returns:
com.ibm.btt.base.Vector

toTags

public Vector toTags()
              throws java.io.IOException
Returns a Vector with the FormatElement represented as a Tag.

Returns:
com.ibm.btt.base.Vector
Throws:
java.io.IOException

unformat

public DataElement unformat(java.lang.String aString,
                            Context aContext)
                     throws DSEInvalidRequestException,
                            DSEInvalidArgumentException
Throws an Exception. Only KeyedCollectionFormats can unformat a Context. This method is implemented for polymorphism.

Parameters:
aContext - com.ibm.btt.base.Context
Returns:
com.ibm.btt.base.DataElement
Throws:
DSEInvalidRequestException
DSEInvalidArgumentException

unformat

public abstract DataElement unformat(java.lang.String aString,
                                     DataElement aDataElement)
                              throws DSEInvalidRequestException,
                                     DSEInvalidArgumentException
Unformat abstract method. To be implemented by the subclasses.

Throws:
DSEInvalidRequestException
DSEInvalidArgumentException

writeExternal

public void writeExternal()
                   throws java.io.IOException
Writes this instance converted in tags in a file. It should be called when the Externalizer has not initialized its tagStream. Once the tagStream is initialized, the method to call is writeExternal().

Throws:
java.io.IOException

writeExternal

public void writeExternal(java.io.ObjectOutput s)
                   throws java.io.IOException
Provides concrete serialization handling for FormatElement.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
s - java.io.ObjectOutput
Throws:
java.io.IOException

unformat

public int unformat(int ndxFrom,
                    int ndxTo,
                    java.lang.String str,
                    DataElement de)
             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).

Parameters:
ndxFrom - is the initial index
ndxTo - one is the final index
Throws:
DSEInvalidRequestException
DSEInvalidArgumentException

unformat

public int unformat(int ndxFrom,
                    int ndxTo,
                    java.lang.String str,
                    Context ctx)
             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).

Parameters:
ndxFrom - is the initial index
ndxTo - one is the final index
Throws:
DSEInvalidRequestException
DSEInvalidArgumentException

isNull

protected boolean isNull(int ndxFrom,
                         int ndxTo)
Check whether the ndxFrom is equals to the ndxTo

Parameters:
ndxFrom - is the initial index
ndxTo - one is the final index

checkIndexes

protected void checkIndexes(int ndxFrom,
                            int ndxTo,
                            java.lang.String str)
                     throws DSEInvalidArgumentException
Check whether the ndxFrom and the ndxTo are valid

Parameters:
ndxFrom - is the initial index
ndxTo - one is the final index
Throws:
DSEInvalidArgumentException

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2011