Creating an imported type for a Java™ class
In the Source view, you create an imported type using a <type>
element. There is a containing element called <import> that contains
all the imported types in the macro script, and there is a <type>
element for each imported type. Figure 1 shows
an <import> element that declares an imported type, followed by
a <vars> element that creates and initializes a variable belonging
to the imported type:
Figure 1. Imported type and variable of that
type
In the figure above the <import> element contains one <type>
element, which has a class attribute
(containing the fully qualified class name, java.util.Hashtable)
and a name attribute (containing the
short name, Hashtable). The <vars> element contains
one <create> element, which as usual specifies a name ($ht$),
a type (Hashtable), and an initial value (which here is
not null but rather is a call to a constructor that returns
an instance of the class, $new Hashtable(40)$).<import>
<type class="java.util.Hashtable" name="Hashtable" />
</import>
<vars>
<create name=$ht$ type="Hashtable" value="$new Hashtable(40)$" />
</vars>
If you are using the source view, you must put all imported types (<type> elements) inside the <import> element. The <import> element itself must appear inside the <HAScript> element (see <HAScript> element) and before the <vars> element.