Features with Default Content
In some cases, you might need some default implementation in an ExpanderExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact. that can be replaced. For this, you add define a feature anchorAnchorA marker within generated source code reserved for adding custom logic during re-expansion. with some default content:
public void helloWorld() {
@anchor:hello:start
System.out.println("Hello World");
@anchor:hello:end
}
If no Feature adds any content for the anchorAnchorA marker within generated source code reserved for adding custom logic during re-expansion., the default content will be used:
public void helloWorld() {
// @anchor:hello:start
System.out.println("Hello World");
// @anchor:hello:end
}
A Feature can define a feature segment like any other:
@hook:hello:start
System.out.println("Hello Universe!");
@hook:hello:end
This will then replace the default content in the expanded artifactArtifactA build or deployment result, such as a Docker container image or Java archive, produced by a software project.:
public void helloWorld() {
// @anchor:hello:start
System.out.println("Hello Universe!");
// @anchor:hello:end
}
If multiple segments are inserted in the anchorAnchorA marker within generated source code reserved for adding custom logic during re-expansion. (e.g. from multiple features), they are concatenated like in a regular feature anchorAnchorA marker within generated source code reserved for adding custom logic during re-expansion..