Write a Custom Formatter

Write a Custom Formatter

Note: If using Web Determinations, writing a Formatter plugin may be required instead, to allow interpreting of user input as well as displaying values. See Formatter plugin overview for more information.

 

A formatter is used by the Determinations Engine when:

 

A formatter is a class that implements the com.oracle.determinations.engine.Formatter interface (in Java) or the Oracle.Determinations.Engine.Formatter interface (in .NET).

The canFormatType and canFormatTemporal methods can be implemented to prevent the formatter being called with unsupported types or with temporal values. In the case of temporal values, a fallback implementation is used that uses the custom formatter to format each individual change point value instead of the whole temporal value.

ThegetFormattedValue method should convert the value, a boxed type (for example, java.lang.Double or Oracle.Masquerade.Lang.Double), into a string representation of that value. The attribute whose value is being formatted (if available) is also supplied so formatting can be overridden on a per-attribute basis.

Installation of the custom formatter is done by providing a rulebase configuration file that specifies the name of the class to be used when the rulebase is loaded.

See also:

Rulebase configuration

Formatter plugin overview