import packageName.simpleName; or import packageName.*;
where:
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:
import com.mycompany.example.MyElement
)import com.mycompany.example.*
)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