Using the Rules Library Functions in Java

The Rules Library functions can be used outside the DSL. First, add the dependency:

<dependency>
    <groupId>com.iconsolutions.dsl</groupId>
    <artifactId>icon-languages-runtime-dependencies</artifactId>
</dependency>

Now the function libraries are available via the EPCFunctions and ISOValidators classes

rules library in java 1

The functions are defined using internal record types of each class. This means for functions that use complex Java types such as determineAddressType the input is not of type PostalAddress24 but instead _KF_PostalAddress24.PostalAddress24. The utility class _KF_PostalAddress24 has static methods toExternal and toInternal which should be used in these cases instead of using the Record types directly.

rules library in java 2