.. ******************************************************************************* * MetaFactory.io R2 * Technical Documentation * * File name : CIX_JCIE_Attribute.rst * Created by : Marnix Bochove (original text) * Last update : 18-03-2021 * Updated by : Niels de Nies * * MetaFactory BV Amsterdam ******************************************************************************* .. include:: /inline-images.txt Attribute ========= is a child element of or and defines the generation of a mapped Java type property, such as int, Integer, String, date etc. Each attribute is a Java property of a Class or Interface. .. see also:: :ref:`Maps ` and/or :ref:`Mappings ` .. rubric:: Usage A java attribute (field of an interface or class) is defined by an attribute element. The name attribute is mandatory and indicates the name of the attribute. .. code-block:: xml :caption: Syntax :name: attribute-01 :linenos: ... ... .. rubric:: Attributes .. list-table:: **attributes of ** :widths: 20 80 :header-rows: 1 :class: tight-table * - Name - Details * - name - The name of the java attribute that is made (also called the field or property). * - visibility - Visibility of this attribute. Possible values are public, protected en private. * - access - The access attribute determines whether getters and setters should be created. Possible values are ro, rw and wo. With ro (readonly) only the getter is generated. With rw (readwrite) both getter and setter are generated. With wo (writeonly) only the setter is generated. If the access attribute is omitted, then neither getter nor setter is generated. * - static - true or false. Indicates whether or not the attribute should be defined static. * - final - true or false. Indicates whether or not the attribute should be defined final. * - transient - true or false. Indicates whether or not the attribute should be defined as transient. * - volatile - true or false. Indicates whether or not the attribute should be defined volatile. * - 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: .. code-block:: condition="${object.name}=Person" In this case, the attribute is made 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). * - .. rubric:: Sub elements .. list-table:: **sub elements of ** :widths: 15 70 15 :header-rows: 1 :class: tight-table * - Name - Details - Number * - library - The value of library is attached as an import statement to the class or interface in which this attribute is defined. - 0 or 1 * - apicomment - Javadoc that is attached to this method. - 0 or 1 * - developercomment - Commentary that is attached to this attribute. - 0 or 1 * - annotation - Annotation defined for the attribute. - 0 or more * - parameter - Parameter of this method. The parameter with the name return is reserved for specifying the return parameter. - 0 or more * - exception - Exception thrown by this method. - 0 or more * - body - The contents of the method. - 0 or 1