Java customization file

What is the customization file?

Modelio Java Designer uses a specific XML file to define the mapping of base types, containers and the default creation of accessors.

These packages are found in the “javaCustomizationFile” XML file, located in the module’s installation directory (< Project_Path >/mda/JavaDesigner/res/custom/).

Mapping model types

You can modify basic type mapping in order to generate your own custom type. The following is an example of type definition from the customization file:

1  <ModelType name="date">
2    <JavaType name="Date">
3       <import name="java.util.Date"/>
4       <wrapper name="Date"/>
5    </JavaType>
6  </ModelType>

Accessor name generation

The second part of the customization file contains the definition for accessor default patterns.

Elements are defined with several cardinalities, according to multiplicities:

MultiplicityCardinality
0..1OptionalSimple.
1..1MandatorySimple.
0..*OptionalMultiple.
n..*MandatoryMultiple.
n..mFinite.

Each definition corresponds to a specific metaclass, for example:

 1  <Attribute card="OptionalSimple">
 2    <getter>
 3       <defaultPattern>get$Name</defaultPattern>
 4       <variants>
 5          <pattern type="boolean">is$Name</pattern>
 6       </variants>
 7    </getter>
 8    <setter>
 9       <defaultPattern>set$Name</defaultPattern>
10    </setter>
11  </Attribute>

This definition contains three parts:

Container generation

In the same part of the customization file, default container can also be specified, for multiple cardinalities. These containers are automatically generated if no container is defined on an element, such as an Attribute, an AssociationEnd or a Parameter. For example:

1   <AssociationEnd card="MandatoryMultiple">
2   <defaultInterfaceContainer name="List">
3   <import name="java.util.List"/>
4   </defaultInterfaceContainer>
5   <defaultImplementationContainer name="ArrayList">
6   <import name="java.util.ArrayList"/>
7   </defaultImplementationContainer>
8 ...

This definition contains two parts:

Note: You can use “Array” if you do not want specific collections to be generated.