Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Texo/Code Generation Patterns

Introduction

The code generation of Texo can be controlled in detail using annotations. This document describes some possible code generation patterns which can be controlled using annotations. In addition this document describes some other specific code generation patterns implemented by Texo.

Let a non-generated class be used for an EClass

Say that you already have a class which implements an EClass, the java class has getters and setters for the EStructuralFeatures of the EClass. Texo makes it possible to use this custom java class in place of the generated class. So Texo won't generate an entity class but will instead use the custom java class. This means that references to the EClass are generated as references to the custom java class.

For example say you have a model with two EClasses: Car and Owner and there is an EReference Car.owner which references the Owner EClass. Then if the Owner is represented by a custom java class: CustomOwner, Texo will make sure that the getter, setter and java member for Car.owner refers to the CustomOwner class.

To tell Texo to take into account the following has to be done:

  • specify a Model Gen Annotation on the EClass
  • set the 'Generate Code' property to false, this makes sure that Texo won't generate an entity class for this EClass
  • set the 'Qualified Class Name' property to the fully qualified of the custom java class

Handling Feature Maps

EMF uses feature maps for flexible structures present in XML Schema (for example the xsd:choice). For more information on EMF feature maps see the following links:

Texo fully supports the EMF feature map.

Generation of a save bi-directional association API (or not)

Only Generate Entities - No EMF dependencies

Generate EMF dependencies in a separate package

Back to the top