IBM Bank Transformation Toolkit Javadoc

com.ibm.btt.format
Class BaseDecorator

java.lang.Object
  extended by com.ibm.btt.format.AbstractFormatElement
      extended by com.ibm.btt.format.BaseDecorator
All Implemented Interfaces:
FormatDecorator, FormatElement
Direct Known Subclasses:
Delimiter, FixedLength, HexDelimiter, JSONDecorator, MaximumLength, NullCheckDecorator, SelfLength, XMLDecorator

public abstract class BaseDecorator
extends AbstractFormatElement
implements FormatDecorator


Field Summary
(package private)  FormatElement decorated
           
 
Fields inherited from class com.ibm.btt.format.AbstractFormatElement
dataName, tagName, TOSTRINGS_MARGIN
 
Constructor Summary
BaseDecorator()
           
 
Method Summary
protected abstract  Message addDecoration(Message message)
           
protected  java.util.Map<java.lang.String,java.lang.String> attributes()
          Generic attributes method.
 Message[] extract(Message message)
          Extracts (strips) the subMessage corresponding to the FormatElement from the input Message and returns it and the remaining Message as the elements of an array.
 Message format(ReadAdapter dataWrapper)
          This method is attended to be called by client code of FormatElement
 java.lang.String getDataName()
          return the corresponding data element name to this IFormatElment.
 FormatElement getDecorated()
          This method is not attended to be called by client code of FormatElement
 boolean isContainer()
          if true, this FormatElement has children. if false, this FormatElement has no children.
protected abstract  Message removeDecoration(Message message)
           
 FormatElement rootDecorated()
          This method is not attended to be called by client code of FormatElement
 void setDecorated(FormatElement format)
          This method is not attended to be called by client code of FormatElement
 java.util.List<java.lang.String> toStrings()
          This method is used to support AbstractFormatElement.toString() method
Client code of Formatter is not allowed to call it.
 void unformat(Message message, WriteAdapter dataAdapter)
          This method is attended to be called by client code of FormatElement
 
Methods inherited from class com.ibm.btt.format.AbstractFormatElement
setDataName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

decorated

FormatElement decorated
Constructor Detail

BaseDecorator

public BaseDecorator()
Method Detail

getDecorated

public FormatElement getDecorated()
Description copied from interface: FormatDecorator
This method is not attended to be called by client code of FormatElement

Specified by:
getDecorated in interface FormatDecorator
Returns:

setDecorated

public void setDecorated(FormatElement format)
Description copied from interface: FormatDecorator
This method is not attended to be called by client code of FormatElement

Specified by:
setDecorated in interface FormatDecorator

getDataName

public java.lang.String getDataName()
Description copied from interface: FormatElement
return the corresponding data element name to this IFormatElment.

Specified by:
getDataName in interface FormatElement
Overrides:
getDataName in class AbstractFormatElement
Returns:

extract

public Message[] extract(Message message)
                  throws ExtractException
Description copied from interface: FormatElement
Extracts (strips) the subMessage corresponding to the FormatElement from the input Message and returns it and the remaining Message as the elements of an array.
The returned array of Message should always contain two elements.

Take Message 1FCD2639FE for example. The returned array of Message may be {1FCD, 2639FE}, the first element 1FCD is the Message required by this FormatElement, while the second element 2639FE is the remaining Message.

This method is not attended to be called by client code of FormatElement
This method is called by the unformat() method of the composite formats such as com.ibm.btt.format.impl.RecordFormat and com.ibm.btt.format.impl.IndexedFormat.

Specified by:
extract in interface FormatElement
Overrides:
extract in class AbstractFormatElement
Returns:
Throws:
ExtractException

format

public Message format(ReadAdapter dataWrapper)
               throws FormatException
Description copied from interface: FormatElement
This method is attended to be called by client code of FormatElement

Specified by:
format in interface FormatElement
Returns:
Throws:
FormatException

isContainer

public boolean isContainer()
Description copied from interface: FormatElement
if true, this FormatElement has children. if false, this FormatElement has no children.

For example:
com.ibm.btt.format.CompositeFormat and its sub class will always return true;
com.ibm.btt.format.FiledFormat and its sub class will always return false;
com.ibm.btt.format.FormatDecorator and its subclass will delegate this method to its decorated FormatElement.

Specified by:
isContainer in interface FormatElement
Returns:

rootDecorated

public FormatElement rootDecorated()
Description copied from interface: FormatElement
This method is not attended to be called by client code of FormatElement

Specified by:
rootDecorated in interface FormatElement
Overrides:
rootDecorated in class AbstractFormatElement
Returns:

unformat

public void unformat(Message message,
                     WriteAdapter dataAdapter)
              throws UnformatException
Description copied from interface: FormatElement
This method is attended to be called by client code of FormatElement

Specified by:
unformat in interface FormatElement
Throws:
UnformatException

addDecoration

protected abstract Message addDecoration(Message message)
                                  throws FormatException
Throws:
FormatException

removeDecoration

protected abstract Message removeDecoration(Message message)
                                     throws UnformatException
Throws:
UnformatException

toStrings

public java.util.List<java.lang.String> toStrings()
Description copied from interface: FormatElement
This method is used to support AbstractFormatElement.toString() method
Client code of Formatter is not allowed to call it.
But subclasses of AbstractFormatElement are allowed to override this method to customize its toString() method.

Specified by:
toStrings in interface FormatElement
Overrides:
toStrings in class AbstractFormatElement
Returns:
List of Strings that represent the FormatElement.

attributes

protected java.util.Map<java.lang.String,java.lang.String> attributes()
Description copied from class: AbstractFormatElement
Generic attributes method. This method parse throw the 'get' methods of the class, and finds out all the attributes of the bean. It is a simple implementation. Customers are recommended to override this method.

Overrides:
attributes in class AbstractFormatElement
Returns:

IBM Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2008