Reference > Rule Languages > ILOG Rule Language > IRL Keywords > import

Summary

This statement is used to import a Java class or package into a rule file. This keyword is used at the top level of the ruleset.

Syntax

import [packageName.] className |packageName.*; 

Description

The import declarations must be the first statements in a rule file. Import statements are not mandatory, but when present, they are always placed at the beginning of the rule file, before the ruleset header. The import statement indicates to ILOG JRules which Java classes may be used in the ruleset. Once imported, the class or package is accessible from the rules. The scope of the import declarations is the ruleset file.

It is possible to import a specific class or an entire package.

There are several Java classes that are implicitly imported. The following Java classes are automatically added by the rule interpreter:

import java.lang.*;
import ilog.rules.engine.*;

Thus, it is not necessary to import classes of these packages explicitly.

Examples

import java.util.*;
import userPackage.UserClass;

The following packages are automatically imported:

java.lang.*; 
ilog.rules.engine.*; 

Here are some examples of class names that may be used as a result of the above two imports:

Class Name 
Qualified Class Name 
Vector 
java.util.Vector 
java.util.Vector 
java.util.Vector 
UserClass 
userPackage.UseClass 
Number 
java.lang.Number 
IlrRule 
ilog.rules.engine.IlrRule