../../_images/Revised.png

4.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 4.37 <external_java_package/> definition syntax
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<code_instruction>
        ...

        <external_java_package>
            id="libName/pathInsideLibraryToFile"
            name=""
            path=""
            foreach="package|object|attribute|reference"
            condition=""
            package=""
        </external_java_package>

        ...
</code_instruction>

Attributes

Table 4.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.