Generating Code for Domain Objects

Domain objects (stereotype «DomainObject») are used to define the internal structure of a component. Domain objects are intended to be used to represent the domain model of a component when it does not need persistence or if a strict separation between persistence and domain objects is expected.

The diagram above shows the transformation of domain objects from the UML model (stereotype «DomainObject») to the matching Java code. As you can see 2 files will be created:

  • Domain Object Base Class (CustomerDOBase)
    This is the base class of the domain object. It contains all the attributes and associations according to the UML model. This also includes access methods for them. For operations defined on domain objects also an abstract method will be generated. The code must not be edited and thus will be written to src-gen.

  • Domain Object Class (CustomerDO)
    This class is the actual domain object implementation. It does not have any attributes or associations as they are inherited from the domain object base class (CustomerDOBase). The generated code contains empty implementation for all modeled operations from the UML model. As those methods have to be implemented manually the class will be written to slot src.

 

For further information please refer to:

Source Code Examples