If you want to use the default generator but need to override the templates to generate some additional content, you can make use of the AROUND aspects feature of Xpand to achieve this goal. The following section lists the currently defined Xpand template hooks together with a brief description of the generated content.
For example to add some arbitrary custom annotations to every attribute contained within an entity could be accomplished with the following around advice.
«EXTENSION extensions::Names»
/**
* adds the annotation 'FooAnnotation' to every entity attribute
*/
«AROUND *::attribute FOR dom::Attribute»
«IF dom::Entity.isInstance(eContainer)-»
@FooAnnotation
private «getImplementationType()» «name-» «IF dom::ValueObject.isInstance(type.dataType)-» = new «getImplementationType()-»()«ENDIF-»;
«ELSE-»
«targetDef.proceed()»
«ENDIF-»
«ENDAROUND»DomainModel::main(Model)
Defines the main entry point template for the DOM generator.
Entity::main(Model)
Defines the main template for Entities and invokes the following templates. Templates named genInterface,manInterface,genClass and manClass are used to create the generated and manual parts of the Interface and Implementation artefacts as described previously in the generation gap pattern section.
Entity::genInterface(Entity)
Entity::manInterface(Entity)
Entity::genClass(Entity)
Entity::manClass(Entity)
Entity::genOperationInterface(Entity) - additional entity
operations within the generated interface
Entity::genOperationImpl(Entity) - additional entity operations
within the generated implementation
Entity::manOperationInterface(Entity) - additional entity
operations within the manual interface
Entity::manOperationImpl(Entity) - additional entity operations
within the manual implementation
Entity::toString(Entity)
Entity::equalsHashCode(Entity)
Entity::compositeIdClass(Entity) - composite identifiers for
entities with composite keys (only)
Repository::main(Model)
Defines the main template for Repositories and invokes the following templates
Repository::genInterface(Dao)
Repository::manInterface(Dao)
Repository::genClass(Dao)
Repository::manClass(Dao)
Repository::genImportsImpl(Dao) - add additional imports in the
generated implementation
Repository::manImportsImpl(Dao)- add additional imports in the
manual implementation
Repository::createOperationInterface(Dao) - create operations
interface
Repository::createOperationImpl(Dao) - create operations
implementation
Repository::genOperationInterface(Dao) - additional repository
operations within the generated interface
Repository::genOperationImpl(Dao)- additional repository
operation implementations in the generated implementation
Repository::manOperationInterface(Dao) - additional repository
operations within the manual interface (only created if not already exists)
Repository::manOperationImpl(Dao)- additional repository
operation implementations in the manual implementation (only created if not
already exists)
Repository::dbConstraintFinderSignature(DataBaseConstraint)
Repository::dbConstraintFinderImpl(DataBaseConstraint)
Repository::daoOperationSignature(Operation)
Repository::daoOperationImpl(Operation)
Repository::queryOperationSignature(QueryOperation)
Repository::queryOperationImpl(QueryOperation)
Service::main(Model)
Defines the main template for Services and invokes the following templates
Service::genInterface(Service)
Service::manInterface(Service)
Service::genClass(Service)
Service::manClass(Service)
Service::manImportsImpl(Service)- add additional imports in the
manual implementation
Service::manImportsImpl(Service)- add additional imports in the
manual implementation
Service::genOperationInterface(Service) - additional service
operations within the generated interface
Service::genOperationImpl(Service)- additional service operation
implementations in the generated implementation
Service::manOperationInterface(Service) - additional service
operations within the manual interface (only created if not already exists)
Service::manOperationImpl(Service)- additional service operation
implementations in the manual implementation (only created if not already
exists)
Service::genInterfaceAnnotation(Service)- additional service
annotations within the generated service interface
DataView::main(Model)
Defines the main template for DataViews and invokes the following templates
DataView::genClass(DataView)
DataView::manClass(DataView)
Validator::main(Model)
Defines the main template for Validators and invokes the following templates
DataView::genValidatorClass(Entity)
DataView::manValidatorClass(Entity)
ValueObject::main(Model)
Defines the main template for ValueObjects and invokes the following templates
ValueObject::genClass(ValueObject)
ValueObject::manClass(ValueObject)
Context::main(Model)
Defines the main template for ValueObjects and invokes the following templates
Context::genInterface(ApplicationSession)
Context::manInterface(ApplicationSession)
Context::genClass(ApplicationSession)
Context::manClass(ApplicationSession)
Features
Various templates for the generation of common ComplexType (Entity,DataView,ValueObject) features like attributes, properties, toString and serialVersionUID.
Features::serialVersionUID(ComplexType) - default
serialVersionUID as XOR hash from the attribute names of the given
ComplexType
Features::toString(ComplexType) - default toString for a
ComplexType
Features::attributes(ComplexType) - generates variable
declaration for all attributes for the given ComplexType
Features::attribute(Attribute) - generates a variable declaration
for the given Attribute
Features::properties(Attribute) - generates setter and getters
implementations for the given Attribute
Features::accessor(Attribute) - getter signature for the given
attribute
Features::mutator(Attribute) - setter signature for the given
attribute
Features::properties(Property) - configuration code for static
property values
Features::operationAnnotation(Operation,isImplementation) -
additional annotations for interface and implementation operations
Features::operationAnnotation(DelegateOperation,isImplementation)
- additional annotations for interface and implementation operations delegating to
repositories
Features::parameterAnnotation(Parameter,isImplementation) -
additional annotations for parameters on interface and implementation
operations