added aggregateid attribute

This commit is contained in:
Niclas Thobaben 2021-07-18 14:48:34 +02:00
parent dedeb2b10c
commit c5acb46f5a
3 changed files with 27 additions and 2 deletions

25
src/java-unions.js Normal file
View file

@ -0,0 +1,25 @@
const utils = require('./utils')
const javaType = require('./java-type')
module.exports = {
mapUnions: (unions, models, namespace, suffix='models') => {
return unions.map(union => {
union.package = `${namespace}.${suffix}`
union.name = utils.pascalcase(union.name)
union.types.forEach(type => {
models.forEach(model => {
if(type.name === model.name) {
model.implements = model.implements || []
model.implements.push(union.name)
}
})
})
return union
})
}
}

View file

@ -20,7 +20,7 @@ import lombok.*;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class {{name}} {
public class {{name}} {{#implements.length}}implements {{#implements}}.{{/implements}}{{/implement.length}} {
@TargetAggregateIdentifier
private {{{aggregateId.type.name}}} {{aggregateId.name}};

View file

@ -27,7 +27,7 @@ import {{{.}}};
**/
@Data
@NoArgsConstructor
public class {{name}} {
public class {{name}} {{#implements.length}}implements {{#implements}}.{{/implements}}{{/implement.length}}{
{{#fields}}
{{#description}}/** {{.}} **/{{/description}}