Commit a2afc0cc authored by Johannes Mey's avatar Johannes Mey
Browse files

make add/set methods return the object (adresses issue #8)

parent e9071a36
Pipeline #2997 passed with stage
in 45 seconds
......@@ -176,12 +176,13 @@ aspect BackendDirectedAPI {
generateGetOne(sb);
// Set
sb.append(ind(1) + "public void " + toTypeDecl());
sb.append(ind(1) + "public " + toTypeDecl() + " " + toTypeDecl());
sb.append(".set" + nameCapitalized() + "(" + ofTypeDecl() + " o) {\n");
if (!optional) {
sb.append(ind(2) + "assertNotNull(o);\n");
}
sb.append(ind(2) + "set" + getImplAttributeName() + "(o);\n");
sb.append(ind(2) + "return this;\n");
sb.append(ind(1) + "}\n");
}
......@@ -324,7 +325,7 @@ aspect BackendBidirectionalAPI {
generateGetOne(sb);
// Set
sb.append(ind(1) + "public void " + toTypeDecl());
sb.append(ind(1) + "public " + toTypeDecl() + " " + toTypeDecl());
sb.append(".set" + nameCapitalized() + "(" + ofTypeDecl() + " o) {\n");
if (!isOpt) {
sb.append(ind(2) + "assertNotNull(o);\n");
......@@ -361,6 +362,7 @@ aspect BackendBidirectionalAPI {
}
}
sb.append(ind(2) + "return this;\n");
sb.append(ind(1) + "}\n");
if (isOpt) {
......@@ -559,7 +561,7 @@ aspect BackendBidirectionalAPI {
generateGetOne(sb);
// Set
sb.append(ind(1) + "public void " + toTypeDecl() + ".set" + nameCapitalized()
sb.append(ind(1) + "public " + toTypeDecl() + " " + toTypeDecl() + ".set" + nameCapitalized()
+ "(" + ofTypeDecl() + " o) {\n");
if (!isOpt) {
sb.append(ind(2) + "assertNotNull(o);\n");
......@@ -587,6 +589,7 @@ aspect BackendBidirectionalAPI {
if (isOpt) {
sb.append(ind(2) + "}\n");
}
sb.append(ind(2) + "return this;\n");
sb.append(ind(1) + "}\n");
if (isOpt) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment