Modelio Java Architect uses a specific XML file to define the mapping of base types, containers and the default creation of accessors.
How to use a customization file?
-
First, find the
javaCustomizationFile.xml
andcustomFile.xsd
files, located in the module’s installation directory: %USERPROFILE%/.modelio/5.0/modules/JavaArchitect_1.3.07/JavaArchitect/res/custom/ -
Create a copy of the custom file and edit it as you want.
-
Make sure the new file is valid according to the XML Schema.
-
In Modelio, open the Java Architect module preferences panel from the menu bar: Configuration→Modules…
-
In the Project Configuration select the Java Architect module.
-
Select and unfold the 'Code generation' group.
-
Reference your new file in the Customization file field.
![]() |
If you change the contents of your customization file after selecting it, it is necessary to either close and reopen the project or
use the Java Architect → ![]() ![]() |
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:
<ModelType name="date">
<JavaType name="Date">
<import name="java.util.Date"/>
<wrapper name="Date"/>
</JavaType>
</ModelType>
-
ModelType
: the base type in Modelio. -
JavaType
: the corresponding java primitive type or class. -
import
: the import line to add at generation, if necessary. -
wrapper
: the java primitive type or class to use if the "wrapper" property is set on the model.
Accessor name generation
The second part of the customization file contains the definition for accessor default patterns.
Element multiplicities in the model correspond to different cardinalities in the customization file:
Multiplicity | Cardinality |
---|---|
0..1 |
OptionalSimple. |
1..1 |
MandatorySimple. |
0..* |
OptionalMultiple. |
n..* |
MandatoryMultiple. |
n..m |
Finite. |
Each definition corresponds to a specific metaclass, for example:
<Attribute>
<OptionalSimple>
<Getter pattern="get$Name">
<Variant typeModelName='boolean' pattern="is$Name" />
</Getter>
<Setter pattern="set$Name" />
</OptionalSimple>
...
</Attribute>
In this example, we are defining accessor patterns for Attributes having the OptionalSimple
(0..1) multiplicity.
This definition contains three parts:
-
Getter pattern
: the default name pattern for accessors generated on an attribute is "get$Name", where $Name is replaced by the name of the attribute. -
Variant
: for an attribute typedboolean
, the name of the getter is "is$Name". -
Setter pattern
: The default name pattern for setters generated on an attribute is "set$Name".
Container generation
In the last part of the customization file, the known collections interfaces/implementations can be extended.
![]() |
Each types defined here will become available in the "Java" view and considered "collections" at reverse/update. |
Example:
<Collections>
<Collection name='LinkedList'
import='java.util.LinkedList'
ordered='true'
unique='false'
map='false'
nullSupport='false'
threadSafe='false'>
<Interface name='Deque'
import='java.util.Deque' />
<Interface name='List'
import='java.util.List' />
</Collection>
</Collections>
This definition contains two parts:
-
The implementation
LinkedList
, with its specific import and properties:-
ordered indicates whether or not the collection maintains ordering of its elements.
-
unique indicates whether or not the collection supports duplicate values by distinguishing between them.
-
map indicates whether or not the collection is 'map' like requiring a key.
-
nullSupport indicates whether or not the collection can store 'null' values.
-
-
The interfaces it implements, with their specific imports.
Note: You can use "Array" if you do not want specific collections to be generated.