Developer Guide

Generating Code for POJOs

Generating Code for POJOs

Stereotype «POJO» can be used to model a POJO (Plain old Java object). It depends on your individual programming model what POJOs will be used for.

Code for POJOs


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

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


  • POJO Class (Account)
    This class is the actual POJO implementation. It does not have any attributes or associations as they are inherited from the POJO base class (AccountBase). 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.


Remark:

  • In case that the POJO in the UML model does not define any operations then only 1 class will be generated to slot src-gen.


For further information please also refer to:


Configuration Parameter

  • generatePOJOs

For further details about configuration parameters for JEAF Generator please refer to: Maven Plugin Configuration


Source Code Examples

AccountBase.java
Account.java