Real Time Information Director User Documentation
RTID Extensibility
Hewlett-Packard Company 13 529618 - 001
public SubStringFormatter(int size)
{
this.separator = null;
this.size = size;
}
public String format(String value)
{
return value;
}
public String unformat(String value)
{
if(value == null)
return value;
String result = "";
if(separator == null)
{
if(size > 0 && size < value.length())
return value.substring(0,size);
else
return value;
}
int index = value.indexOf(separator);
if(index == -1)
return value;
return value.substring(0,index);
}
}
3. If the baseline does not include a suitable Formatter object, create a custom
Formatter that subclasses the class com.hp.rtsc.metadata.formatters.Formatter.
Refer to the RTID Metadata Language module for more information about
formatters.
4. Add the appropriate formatter to obtain the desired output. Modify the
constructor of the Java object to specify the Formatter object. An example of an
element using the Formatter object is the following definition in Orders05.java,
which uses a predefined formatter.
new FieldElement("POSEX", "SALES_ORDER_ITEM_NO", IDOC.ITEM_NO);
In addition to formatters that convert data elements, the Director supports more complex
formatters that apply custom business logic to a whole record. See “Segment Formatter
Classes” in the RTID Metadata Language module.