4.2.2.1. Object

The element <object> defines a data entity in the data model and lives within the scope its parent package. The model can potentially contain a multitude of packages, each with their set of child objects. The objects can be equipped with attributes that refer to standard Java types such as String, Boolean, LocalDate etc., while references point to other objects that are defined in the same model package. Like its parent package and children attributes/references, an object can contain metadata that patterns can use in their logic.

An example is shown below.

Listing 4.13 <Object> syntax
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8"?>
<model xmlns="https://metafactory.io/xsd/v1/model"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="https://metafactory.io/xsd/v1/model
                           https://metafactory.io/xsd/v1/model.xsd">

        <package name="yourModelPackage">
                <object name="yourObjectName01">
                        0 or more <properties></properties>
                        0 or more <reference name="yourReferenceName" type="typeOfYourReference" multiplicity="0..n"></reference>
                        0 or more <attribute name="yourAttribute01"></attribute>
                        ...
                </object>
                ...
        </package>
        ...
</model>

Syntax of <object/>

<object name=””> </object>

Attributes

Table 4.7 attributes of <Object/>

Name

Details

Required

name

Name of the object in the package “yourModelPackage” of the MetaFactory model (model.xml). This name “yourObjectName01” has to be unique.

Mandatory

Sub elements

Table 4.8 <Object/> sub elements

Name

Details

Number

properties

An object may contain 0 .. n metadata. This metadata is contained in a <property>, which is a child element of <properties>. With the properties of an object the pattern logic can make decisions or it can itself add metadata to the object.

0 .. n

reference

The reference points to another object and specifies the type of relationship with that object (e.g. notnull and multiplicity)

0 .. n

attribute

Attributes refer to standard object types, e.g. String, Boolean, LocalDate etc.

0 .. n