import

Syntax

import packageName.simpleName;
or
import packageName.*;

where:

Description

The import statement makes the referenced element (text template, ruleset or Java type) directly available in the ruleset. You can then use the element using its simple name, rather than having to use a qualified name. You may also make the whole content of a package directly available using the '*' (star) character.

When an element is referenced in the ruleset contents using a simple name (e.g. MyElement), the element is resolved this way:

  1. The element is searched in the ruleset declared package.
  2. If not found, it is searched in the named imports (e.g. import com.mycompany.example.MyElement)
  3. If not found, it is searched in the package imports (e.g. import com.mycompany.example.*)

Examples

A script that won't compile due to an unresolved type:

public script myScript(values : List) { // List is unresolved !
}

The script can be rewritten to use a qualified name:

public script myScript(values : java.util.List) { // java.util.List is valid
}

Or we can introduce an import to keep the simple notation:

import java.util.*;
...
public script myScript(values : List) { // List is resolved to java.util.List
}

Importing a text template:

import com.mycompany.example.GenerateFile;
...
$GenerateFile(); // GenerateFile is resolved to com.mycompany.example.GenerateFile