5.4.2.8. External Java package

Code reuse

To support reuse of code instructions between projects, java_packages can be collected in (external) libraries, which are accessable from outside.

Same attributes

The external_java_package calls the package in the library. So the external_java_package acts as an include. The external_java_package has exactly the same kind of attributes as the java_package. But because the external_java_package is part of a different project, for some attributes it will need different values. This is why the external_java_package’s attributes overrule those of the original java_package.

Usage

Listing 5.37 <external_java_package/> definition syntax
 1<code_instruction>
 2        ...
 3
 4        <external_java_package>
 5            id="libName/pathInsideLibraryToFile"
 6            name=""
 7            path=""
 8            foreach="package|object|attribute|reference"
 9            condition=""
10            package=""
11        </external_java_package>
12
13        ...
14</code_instruction>

Attributes

Table 5.47 attributes of <external_java_package/>

Name

Details

id

id of the external java package. Required

The syntax of the id attribute is as follows:

id="libName/pathInsideLibraryToFile"

Say there is an external library defined with name: lib1. You want to use a code instruction file with the name authentication.xml located in the folder: ‘packages/seam/component/’ under the code_instruction_folder of lib1. The value of the id attribute must then be defined as follows:

<external_java_package id="lib1/packages/seam/component/authentication.xml" />

Exclam M Do not repeat the value of <code_instruction_folder> as defined in the external_library in the external_java_package id.

name

The name of the java package made

path

The path relating to the java output folder as defined in the MetaFactory project.

writePolicy

Generates the source only if the source does not already exist. Values: once|always. Default: allways

code instruction base

Loupe S Code instruction base.