Wrappers

A wrapper is a Java class that exposes decision tables as Java methods, data tables as Java objects and allows developers to access table information from code. To access a particular table from Java code, a wrapper Java class must be generated for the Excel or Word file where the table is defined. Wrappers are essential for solutions where compiled OpenL Tablets project code is embedded in solution applications. If tables are accessed through web services, client applications are not aware of wrappers but they may be still used on the server.

Wrappers can be dynamic or static as described in the following table:

Wrapper types

Type

Description

Dynamic

For a dynamic wrapper, only a rule interface must be defined upon project creation. The rules run-time factory provides instances implementing this interface in run-time.

Using dynamic wrappers, and not the static wrappers, is recommended.

Static

The wrapper Java class is generated in a rule project for a static wrapper, which contains all OpenL Tablets API usage logic to call rules.

Using dynamic wrappers, rather than static wrappers,is more advantageous as it enables OpenL Tablets users to clearly define the rules displayed in the application. Using a static wrapper can be inconvenient in that a wrapper must be regenerated each time a new version of OpenL Tablets is released.

OpenL Tablets provides a specific Ant task that can be used for static generation of a wrapper from any Excel or Word file automatically.

A static wrapper class must be regenerated in the following situations:

Wrapper classes do not have to be regenerated if table data is modified or if conditions and actions are added or removed.

For more information on generating wrappers, see Generating a Wrapper.