Java Model projects
A Java Model project is generated from the business object model (BOM) project to be used by Java™ agents, OSGi services, and test driver clients.
All BOM classes and interfaces that are generated from the .bmd files
within the BOM project and are tagged with the de.generated property
generate a Java class and an
interface in the Java Model project. The generated
interfaces are created in a package with the same name that is used
in the BOM project. The implementation classes are generated in another
package.
To be able to create class instances, an interface that is named ConceptFactory is created in each package. The
interface contains a create[Classname]
method for each public constructor of the BOM class.
A BOM includes only public members, and therefore BOM classes do not have a default constructor. If a BOM class has a constructor without parameters, it must be declared in the BOM.
| BOM type | BOM project | Java Model project | Description |
|---|---|---|---|
| Class | |
A Java interface myPackage.MyClass. A Java class for the implementation (not for public use). |
A class in the BOM creates both an interface and an implementation class. |
| Class constructor | |
In addition to the Java interface
MyClass, there is a myPackage.ConceptFactory interface that contains
createMyClass(String p); |
A constructor in the BOM creates a method in
the generated ConceptFactory interface. |
| Class with an enumerated domain | |
A Java
enum: |
An enumerated type in the BOM creates a Java enum type. |
| Interface | |
A Java interface myPackage.MyClass. |
A BOM interface creates a Java interface. |
The BOM attributes are mapped to get and
set methods that are named according to the
JavaBeans convention. The attribute modifiers, such as
readonly, writeonly, final, or static have an obvious mapping to those methods. In addition to these
obvious mappings, some attributes with a specific meaning or a specific type are mapped in a
different way (see table 2), as are attribute of collection types (see table 3).
| BOM type | BOM project | Java Model project | Description |
|---|---|---|---|
| Id of an entity | |
The implementation directly implements the Java methods get$Id() and get$TypeName() from the entity interface. In
addition, the hashcode and equals methods are implemented and based on the id
information. |
An entity class is mapped as a regular class, some method implementations are generated. |
| Timestamp of an event | |
The implementation directly implements the Java methods get$Timestamp() and
get$TypeName() from the event interface. In
addition, the hashcode and equals methods are implemented and based on the
$Id information. |
An event class is mapped as a regular class, some method implementations are generated. In addition, a field to represent the event id is generated. |
| Attribute of an entity type | |
The generated Java interface contains:
|
A BOM attribute of an entity type is mapped to a Java field of Relationship type. From a Relationship instance, the real entity object can be retrieved by calling the resolve
method. |
In the following table, the List type is
used, but the mapping can also be done with Collection and Set.
| BOM type | BOM project | Java Model project | Description |
|---|---|---|---|
| Attribute of collection type | |
In the Java interface, the attribute of
a collection type is:
These
methods are implemented in the generated implementation. The getter method returns a read only
version of the collection, and never returns null. The setter method creates a shallow copy of the
parameter. |
The type information of the domain is used to produce generic types. |
| Attribute of collection type with add, remove, clear, and set methods | |
In addition to the get and set methods, the addTo_concepts, removeFrom_concepts, set_concepts, and clear_concepts methods are present in the
interface:
They
are also included in the generated implementation. |
The generated implementation depends on the prefix of the name of the method,
and on the content of the collectionAttribute property. The method name after the prefix is not relevant.The
The The The |
| Attribute of collection of entity type | |
In the Java interface, the attribute of
a collection type is:
|
The type information of the domain is used to produce entity types. |
| Attribute of collection of entity type with add, remove, clear, get, and set methods | |
In addition to the get and set methods, the addTo_entities, removeFrom_entities, clear_entities, getFrom_entities, and set_entities, methods are present in the interface:
They are also included in the generated implementation. |
The generated implementation depends on the prefix of the name of the method,
and on the content of the collectionAttribute property. The method name after the prefix is not relevant.The
The The The The |