Implementing a Custom Field Serializer with ICustomSerializerField

To write a custom serializer for a field type in a message definition, implement the ICustomSerializerField interface. Write your own custom logic to transform a field and write the data back to the output message. The result of this process is a custom class that is an extension point of a field. The JAR must reside in the CustomClasses folder or subfolder. When editing a message definition in the Message Definition Editor, you can assign this custom class to any number of fields.

Full source for ICustomSerializerField:

package com.sybase.jtf.serializer.api;

/**
 * This interface allows the user to define their own method to write to the 
 * output message.
 */
public interface ICustomSerializerField
{
	/**
	 * This method allows the user to define a way to modify the data in a field
	 * and write the modified data to the messsage directly.  The byte array that 
	 * is returned will be added to the output message.
	 * 
	 * @param fieldData               An array of bytes that contains the data
	 *                                in the field named in the message definition.
	 *                                Note that this will be a null reference if
	 *                                no field is named in the message definition.
	 * @throws SerializationException Thrown if this method fails for any reason
	 *                                (as defined by the user).  A call to the
	 *                                method Exception.getMessage() will be made
	 *                                if the exception is considered fatal to
	 *                                the serialization of the message being 
	 *                                processed.
	 */
	public byte[] serializeField(byte[] fieldData) throws SerializationException;
}

Developing a Message Definition

Developing Custom Classes for Transforming Message Definition Fields

Implementing a Custom Field Parser with ICustomParserField

Implementing a Custom Parser Extension with IParseExtension

Adding a Field to a Message Definition

Custom Wire Formats

Troubleshooting Custom Wire Formats

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com