MENU

  /   Interface

Background

<interface> is a child element of <package> and defines the generation of a Java Interface.

 

Usage

The name attribute is mandatory and defines the name of the interface. An example of an <interface> element is shown below.

<?xml version="1.0" encoding="UTF-8"?>
<pattern xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.firstbase.nl/xsd/personaliom/pattern" xsi:schemaLocation="http://www.firstbase.nl/xsd/personaliom/pattern http://www.firstbase.nl/xsd/personaliom/pattern.xsd">

  ...
    <interface name="" visibility="" foreach="package|object|attribute|reference" condition="" package="" var0="" var1="" var2="" var3="" var4="" var5="">
      <generic></generic>
      <apicomment></apicomment>
      <developercomment></developercomment>
      <libraries>
        <library></library>
        <library></library>
        ...
        <library></library>
      </libraries>
      <annotation></annotation>
      <inherits condition="" foreach="package|object|attribute" package=""></inherits>
      <attribute></attribute>
      <operation></operation>
    </interface>
  ...
</pattern>

 

attributes of <interface/>

Name Details
name The name of the java interface that is made
visibility Visibility of this interface. In practice this is always public
foreach Indicates whether the interface must be created for each element in model (value of foreach determines what model element). Possible values: package, object, attribute, reference
condition An expression that evaluates to true or false. Generation of the current file wil precede if true and otherwise not. Example:

condition="${object.name}=Person"

In this case, the package is generated only if the current model object has the name: Person. This works only if all model objects are iterated (foreach=”object”).

package The name of the package in the model (model.xml) that must be used to apply the foreach attribute
object The name of the object in the model (model.xml) that must be used to apply the foreach attribute
var0 Value that you wish to store in the pre-defined variable with the name var0. Reference to this value can be made later by means of: ${var0}. This can be used in both the pattern and in a snippet (freemarker or velocity template).
var1 Value that you wish to store in the pre-defined variable with the name var1. Reference to this value can be made later by means of: ${var1}. This can be used in both the pattern and in a snippet (freemarker or velocity template).
var2 Value that you wish to store in the pre-defined variable with the name var2. Reference to this value can be made later by means of: ${var2}. This can be used in both the pattern and in a snippet (freemarker or velocity template).
var3 Value that you wish to store in the pre-defined variable with the name var3. Reference to this value can be made later by means of: ${var3}. This can be used in both the pattern and in a snippet (freemarker or velocity template).
var4 Value that you wish to store in the pre-defined variable with the name var4. Reference to this value can be made later by means of: ${var4}. This can be used in both the pattern and in a snippet (freemarker or velocity template).
var5 Value that you wish to store in the pre-defined variable with the name var5. Reference to this value can be made later by means of: ${var5}. This can be used in both the pattern and in a snippet (freemarker or velocity template).

 

subelements of <interface/>

Name Details Number
generic Makes the interface generic (java 1.5 or higher). 0 or 1
apicomment Javadoc for this interface. 0 or 1
developercomment Commentary that is attached to this interface. 0 or 1
libraries All library elements under libraries are translated in the interface as import statements. 0 or 1 (library 0 or more)
annotation Annotation defined for the interface. 0 or more
inherits The interface from which this interface is derived. 0 or more
attribute Those attributes contained in this interface. Only static attributes are added to the interface. When an attribute is non-static, only the getters and setters of this attribute are created (depending on the access attribute (rw|ro|wo)). This is a handy way to establish the getters and setters in an interface quickly. 0 or more
operation Methods contained in this interface. 0 or more