To add your own format element according to your needs, do the following:
<?xml version="1.0"?> <btt.xml> <kColl id="components"> <kColl id="format"> <field id="initializer" value="com.ibm.btt.format.FormatInitializer" /> <field id="extFile" value="format.xml" /> <kColl id="classTable"> <field id="myFormat" value="com.mycompany.format.MyFormatElement" /> </kColl> </kColl> </kColl> </btt.xml>
Base Class | Methods | Override | Description |
---|---|---|---|
CompositeFormat | public Message[] extract(Message message) throws ExtractException; | YES | Split the input message into two messages, and return them as an array in length of 2. The first message in the array is the message that should be processed by this format element, and the second message is the remaining message. 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. |
public Message format(ReadAdapter dataAdapter) throws FormatException; | YES | Translate the data into binary message. | |
public void unformat(Message message, WriteAdapter dataAdapter) throws UnformatException | YES | Translate the binary message into data. | |
public List<FormatElement>getChildren (); | NO | Return the children format element of the composite format element. You can call it in extract, format and unformat methods. | |
FieldFormat | public Message[] extract(Message message) throws ExtractException; | YES | Split the input message into two messages, and returned them as an array in length of 2. |
public Message format(ReadAdapter dataAdapter) throws FormatException; | YES | Translate the data into binary message. | |
public void unformat(Message message, WriteAdapter dataAdapter) throws UnformatException | YES | Translate the binary message into data. | |
BaseDecorator | public Message[] extract(Message message) throws ExtractException; | YES | Split the input message into two messages, and returned them as an array in length of 2. |
protected Message addDecoration(Message message) throws FormatException; | YES | Modify the binary message after execute format method of the decorated format element. | |
protected Message removeDecoration(Message message) throws UnformatException; | YES | Modify the binary message before execute unformat method of the decorated format element. |
protected Map<String, String> attributes();
You can override this method. It returns a Map with both key and value in type of String. The key represents the attribute name and the value represents the attribute value. This method is only used in toString() method of the format element.