Only an interface must be defined when creating a project for a dynamic wrapper. OpenL Tablets users can clearly define rules displayed in the application by using this interface. Using dynamic wrappers is a recommended practice.
This section illustrates the creation of a dynamic wrapper for a Simple project in Eclipse with the OpenL Tablets Eclipse Update Site installed. Only one rule hello1 is created in the Simple project by default.
Proceed as follows:
In the project src
folder, create an interface as follows:
public interface simple {
void hello1(int i);
}
Create a class for a wrapper as follows:
package template;
import static java.lang.System.out;
import org.openl.rules.runtime.RuleEngineFactory;
public class Dynamic_wrapper {
public static void main(String[] args) {
//define the interface
RuleEngineFactory<simple> rulesFactory = new RuleEngineFactory<simple>("rules/TemplateRules.xls", simple.class);
simple rules = rulesFactory.newInstance();
rules.hello1(12);
}
}
When the class is run, it executes and displays Good Afternoon, World!