ddd-templates
Xtend based domain-driven design (DDD) code generation templates for use with SrcGen4J
What is this?
The project provides several artifact factories that can be used to generate code using SrcGen4J: srcgen4j-common / srcgen4j-core / srcgen4j-maven from an Xtext based DDD DSL model.
An artifact factory is a piece of code that creates an artifact for a given model element. The result is Java code based on utility classes defined in the ddd-4-java project.
Aggregate Factories
Factories generating code based on the the 'aggregate' model element.
| Factory Name | Reference | Description | Example |
|---|---|---|---|
| AbstractAggregateArtifactFactory | AbstractAggregateRoot | Abstract aggregate root Java class. | AbstractAggregateA |
| FinalAggregateArtifactFactory | - | Final aggregate root Java source extending the above abstract class. | AggregateA |
| AggregateDocArtifactFactory | - | HTML file with a description of the aggregate. | - |
| ESJpaEventArtifactFactory | JpaStreamEvent | JPA entity that stores all events of an aggregate type. | - |
| ESJpaEventIdArtifactFactory | - | JPA key for an event that is based on the aggregate identifier and version number. | - |
| ESJpaLiquibaseXmlArtifactFactory | - | Liquibase XML databaseChangeLog that creates all necessary tables for the aggregates. | - |
| ESJpaStreamArtifactFactory | JpaStream | JPA entity for storing the aggregate stream itself (not the events). | - |
| ESRepositoryArtifactFactory | EventStoreRepository | Event store based repository for a single aggregate type. | AggregateCRepository |
| ESRepositoryFactoryArtifactFactory | - | Creates a CDI based producer that creates above event store repsoitory. | AggregateCRepositoryFactory |
For an explanation of the generated event store commons JPA types, see the documentation.
See source code.
Aggregate ID Factories
Factories generating code based on the the 'aggregate-id' model element.
| Factory Name | Reference | Description | Example |
|---|---|---|---|
| AbstractAggregateIdArtifactFactory | AggregateRootId | Abstract aggregate root identifier Java class. | AbstractMyAggregateId |
| FinalAggregateIdArtifactFactory | - | Final aggregate root identifier Java source extending the above abstract class. | MyAggregateId |
| AggregateIdArtifactFactory | AggregateRootId | Aggregate root identifier Java class (Not splitted into 'abstract' and 'final' parts). | MyAggregateId |
| AggregateIdConverterArtifactFactory | - | Aggregate root identifier converter for JPA/JAXB/JSONB. | MyAggregateIdConverter |
| AggregateIdStreamFactoryArtifactFactory | IdStreamFactory | |
Example |
| SimpleAggregateIdArtifactFactory | AggregateRootUuid | UUID based aggregate root identifier Java class. | MyAggregate5Id |
See source code.
Constraint Factories
See source code.
Entity Factories
See source code.
Entity ID Factories
See source code.
Enum Object Factories
See source code.
Event Factories
See source code.
Exception Factories
See source code.
Resource Set Factories
See source code.
Service Factories
See source code.
Value Object Factories
See source code.
Snapshots
Snapshots can be found on the OSS Sonatype Snapshots Repository.
Add the following to your .m2/settings.xml to enable snapshots in your Maven build:
<repository>
<id>sonatype.oss.snapshots</id>
<name>Sonatype OSS Snapshot Repository</name>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
