Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import de.monticore.codegen.cd2java._ast.builder.buildermethods.BuilderMutatorMethodDecorator;
import de.monticore.codegen.cd2java._symboltable.SymbolTableService;
import de.monticore.generating.templateengine.GlobalExtensionManagement;
import de.monticore.generating.templateengine.HookPoint;
import de.monticore.generating.templateengine.StringHookPoint;
import de.monticore.generating.templateengine.TemplateHookPoint;
import de.monticore.types.mcbasictypes._ast.ASTMCType;
Expand Down Expand Up @@ -74,6 +75,8 @@ public ASTCDClass decorate(final ASTCDClass symbolClass) {
ASTCDClass symbolBuilder = builderDecorator.decorate(decoratedSymbolClass);
builderDecorator.setPrintBuildMethodTemplate(true);

addAccessModifierDefaultValue(symbolBuilder);

if (hasInheritedSymbol) {
// set superclass
Map<ASTCDClass, String> values = symbolTableService.getInheritedSymbolPropertyClasses(Lists.newArrayList(symbolClass));
Expand Down Expand Up @@ -142,7 +145,6 @@ protected List<ASTCDAttribute> createSymbolAttributes(ASTCDClass symbolClass) {
attrs.add(this.getCDAttributeFacade().createAttribute(PROTECTED.build(), optionalTypeOfASTNode, AST_NODE_VAR));

ASTCDAttribute accessModifier = this.getCDAttributeFacade().createAttribute(PROTECTED.build(), ACCESS_MODIFIER, "accessModifier");
this.replaceTemplate(VALUE, accessModifier, new StringHookPoint("= " + ACCESS_MODIFIER_ALL_INCLUSION));
attrs.add(accessModifier);

attrs.add(this.getCDAttributeFacade().createAttribute(PROTECTED.build(),
Expand All @@ -151,6 +153,14 @@ protected List<ASTCDAttribute> createSymbolAttributes(ASTCDClass symbolClass) {
return attrs;
}

protected void addAccessModifierDefaultValue(ASTCDClass builder) {
HookPoint defaultVal = new StringHookPoint("= " + ACCESS_MODIFIER_ALL_INCLUSION);

builder.getCDAttributeList().stream()
.filter(a -> "accessModifier".equals(a.getName()))
.forEach(a -> this.replaceTemplate(VALUE, a, defaultVal));
}

protected List<ASTCDMethod> getMethodsForDefaultAttrs(List<ASTCDAttribute> defaultAttrs,
BuilderMutatorMethodDecorator builderMutatorMethodDecorator) {
return defaultAttrs.stream()
Expand Down
Loading