[JavaSpring] Call parent fluent setters from child (#16497)

* Call fluent parent setter from child pojo

This closes #16496

* Generate new samples
This commit is contained in:
Robin Jonsson
2023-09-06 05:43:35 +02:00
committed by GitHub
parent b1ec110aa3
commit acb798b58b
68 changed files with 299 additions and 173 deletions

View File

@@ -199,7 +199,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
{{! begin feature: fluent setter methods for inherited properties }}
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
super.{{setter}}({{name}});
super.{{name}}({{name}});
return this;
}
{{#isArray}}

View File

@@ -72,6 +72,19 @@ public class JavaFileAssert extends AbstractAssert<JavaFileAssert, CompilationUn
return this;
}
public JavaFileAssert assertNoMethod(final String methodName, final String... paramTypes) {
List<MethodDeclaration> methods = paramTypes.length == 0
? actual.getType(0).getMethodsByName(methodName)
: actual.getType(0).getMethodsBySignature(methodName, paramTypes);
String message = paramTypes.length == 0
? "Expected not to find a single method %s, but found " + methods.size()
: "Expected not to find a method %s with parameter(s) %s, but found " + methods.size();
Assertions.assertThat(methods)
.withFailMessage(message, methodName, Arrays.toString(paramTypes))
.isEmpty();
return this;
}
public MethodAssert assertMethod(final String methodName, final String... paramTypes) {
List<MethodDeclaration> methods = paramTypes.length == 0
? actual.getType(0).getMethodsByName(methodName)

View File

@@ -3002,6 +3002,63 @@ public class SpringCodegenTest {
.containsWithName("org.springframework.security.access.prepost.PreAuthorize");
}
@Test
public void doCallFluentParentSettersFromChildModel() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
String outputPath = output.getAbsolutePath().replace('\\', '/');
OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/3_0/issue_16496.yaml", null, new ParseOptions()).getOpenAPI();
SpringCodegen codegen = new SpringCodegen();
codegen.setOutputDir(output.getAbsolutePath());
codegen.setOpenApiNullable(true);
codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true");
ClientOptInput input = new ClientOptInput();
input.openAPI(openAPI);
input.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();
JavaFileAssert.assertThat(Paths.get(outputPath + "/src/main/java/org/openapitools/model/Animal.java"))
// Fluent method assertions
.assertMethod("alias")
.hasReturnType("Animal")
.bodyContainsLines("this.alias = JsonNullable.of(alias);", "return this;")
.hasParameter("alias")
.withType("String")
.toMethod()
.toFileAssert()
// Setter method assertions
.assertMethod("setAlias")
.hasReturnType("void")
.hasParameter("alias")
.withType("JsonNullable<String>");
JavaFileAssert.assertThat(Paths.get(outputPath + "/src/main/java/org/openapitools/model/Zebra.java"))
// Fluent method assertions
.assertMethod("alias")
.hasReturnType("Zebra")
.bodyContainsLines("super.alias(alias);", "return this;")
.hasParameter("alias")
.withType("String")
.toMethod()
.toFileAssert()
// No overridden setter on child object
.assertNoMethod("setAlias");
}
@Test
public void multiLineOperationDescription() throws IOException {

View File

@@ -0,0 +1,56 @@
openapi: 3.0.0
servers:
- url: 'localhost:8080'
info:
version: 1.0.0
title: OpenAPI Zoo
license:
name: Apache-2.0
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
paths:
/zebras:
get:
operationId: getZebras
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Zebra'
components:
schemas:
Animal:
type: object
discriminator:
propertyName: type
properties:
type:
type: string
enum:
- zebra
name:
type: string
example: 'Marty'
age:
type: integer
example: 15
alias:
type: string
nullable: true
description: 'The stripy one'
example: 'Stripy'
Zebra:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
stripePattern:
type: string
enum:
- horizontal
- vertical

View File

@@ -98,17 +98,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -66,12 +66,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -58,12 +58,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -89,17 +89,17 @@ public class BigCatDto extends CatDto {
public BigCatDto declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCatDto className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCatDto color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -56,12 +56,12 @@ public class CatDto extends AnimalDto {
public CatDto className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public CatDto color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -49,12 +49,12 @@ public class DogDto extends AnimalDto {
public DogDto className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public DogDto color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -90,17 +90,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -58,12 +58,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -50,12 +50,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -129,22 +129,22 @@ public class Bar extends Entity implements BarRefOrValue {
public Bar href(String href) {
super.setHref(href);
super.href(href);
return this;
}
public Bar atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
super.atSchemaLocation(atSchemaLocation);
return this;
}
public Bar atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
super.atBaseType(atBaseType);
return this;
}
public Bar atType(String atType) {
super.setAtType(atType);
super.atType(atType);
return this;
}
@Override

View File

@@ -108,27 +108,27 @@ public class BarCreate extends Entity {
public BarCreate href(String href) {
super.setHref(href);
super.href(href);
return this;
}
public BarCreate id(String id) {
super.setId(id);
super.id(id);
return this;
}
public BarCreate atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
super.atSchemaLocation(atSchemaLocation);
return this;
}
public BarCreate atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
super.atBaseType(atBaseType);
return this;
}
public BarCreate atType(String atType) {
super.setAtType(atType);
super.atType(atType);
return this;
}
@Override

View File

@@ -39,37 +39,37 @@ public class BarRef extends EntityRef implements BarRefOrValue {
public BarRef name(String name) {
super.setName(name);
super.name(name);
return this;
}
public BarRef atReferredType(String atReferredType) {
super.setAtReferredType(atReferredType);
super.atReferredType(atReferredType);
return this;
}
public BarRef href(String href) {
super.setHref(href);
super.href(href);
return this;
}
public BarRef id(String id) {
super.setId(id);
super.id(id);
return this;
}
public BarRef atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
super.atSchemaLocation(atSchemaLocation);
return this;
}
public BarRef atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
super.atBaseType(atBaseType);
return this;
}
public BarRef atType(String atType) {
super.setAtType(atType);
super.atType(atType);
return this;
}
@Override

View File

@@ -83,27 +83,27 @@ public class Foo extends Entity implements FooRefOrValue {
public Foo href(String href) {
super.setHref(href);
super.href(href);
return this;
}
public Foo id(String id) {
super.setId(id);
super.id(id);
return this;
}
public Foo atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
super.atSchemaLocation(atSchemaLocation);
return this;
}
public Foo atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
super.atBaseType(atBaseType);
return this;
}
public Foo atType(String atType) {
super.setAtType(atType);
super.atType(atType);
return this;
}
@Override

View File

@@ -61,37 +61,37 @@ public class FooRef extends EntityRef implements FooRefOrValue {
public FooRef name(String name) {
super.setName(name);
super.name(name);
return this;
}
public FooRef atReferredType(String atReferredType) {
super.setAtReferredType(atReferredType);
super.atReferredType(atReferredType);
return this;
}
public FooRef href(String href) {
super.setHref(href);
super.href(href);
return this;
}
public FooRef id(String id) {
super.setId(id);
super.id(id);
return this;
}
public FooRef atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
super.atSchemaLocation(atSchemaLocation);
return this;
}
public FooRef atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
super.atBaseType(atBaseType);
return this;
}
public FooRef atType(String atType) {
super.setAtType(atType);
super.atType(atType);
return this;
}
@Override

View File

@@ -61,27 +61,27 @@ public class Pasta extends Entity {
public Pasta href(String href) {
super.setHref(href);
super.href(href);
return this;
}
public Pasta id(String id) {
super.setId(id);
super.id(id);
return this;
}
public Pasta atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
super.atSchemaLocation(atSchemaLocation);
return this;
}
public Pasta atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
super.atBaseType(atBaseType);
return this;
}
public Pasta atType(String atType) {
super.setAtType(atType);
super.atType(atType);
return this;
}
@Override

View File

@@ -70,27 +70,27 @@ public class Pizza extends Entity {
public Pizza href(String href) {
super.setHref(href);
super.href(href);
return this;
}
public Pizza id(String id) {
super.setId(id);
super.id(id);
return this;
}
public Pizza atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
super.atSchemaLocation(atSchemaLocation);
return this;
}
public Pizza atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
super.atBaseType(atBaseType);
return this;
}
public Pizza atType(String atType) {
super.setAtType(atType);
super.atType(atType);
return this;
}
@Override

View File

@@ -62,32 +62,32 @@ public class PizzaSpeziale extends Pizza {
public PizzaSpeziale pizzaSize(BigDecimal pizzaSize) {
super.setPizzaSize(pizzaSize);
super.pizzaSize(pizzaSize);
return this;
}
public PizzaSpeziale href(String href) {
super.setHref(href);
super.href(href);
return this;
}
public PizzaSpeziale id(String id) {
super.setId(id);
super.id(id);
return this;
}
public PizzaSpeziale atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
super.atSchemaLocation(atSchemaLocation);
return this;
}
public PizzaSpeziale atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
super.atBaseType(atBaseType);
return this;
}
public PizzaSpeziale atType(String atType) {
super.setAtType(atType);
super.atType(atType);
return this;
}
@Override

View File

@@ -101,17 +101,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -69,12 +69,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -61,12 +61,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -101,17 +101,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -69,12 +69,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -61,12 +61,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -101,17 +101,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -69,12 +69,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -61,12 +61,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -101,17 +101,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -69,12 +69,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -61,12 +61,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -102,17 +102,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -70,12 +70,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -102,17 +102,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -70,12 +70,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -102,17 +102,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -70,12 +70,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -102,17 +102,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -70,12 +70,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -102,17 +102,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -70,12 +70,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -102,17 +102,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -70,12 +70,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -102,17 +102,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -70,12 +70,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -62,12 +62,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -101,17 +101,17 @@ public class BigCat extends Cat {
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -69,12 +69,12 @@ public class Cat extends Animal {
public Cat className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -61,12 +61,12 @@ public class Dog extends Animal {
public Dog className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -104,17 +104,17 @@ public class BigCatDto extends CatDto {
public BigCatDto declawed(Boolean declawed) {
super.setDeclawed(declawed);
super.declawed(declawed);
return this;
}
public BigCatDto className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public BigCatDto color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -71,12 +71,12 @@ public class CatDto extends AnimalDto {
public CatDto className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public CatDto color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override

View File

@@ -64,12 +64,12 @@ public class DogDto extends AnimalDto {
public DogDto className(String className) {
super.setClassName(className);
super.className(className);
return this;
}
public DogDto color(String color) {
super.setColor(color);
super.color(color);
return this;
}
@Override