[Java/Spring] all-of and one-of Improvements and Fixes (was #12075) (#12089)

* Fix Bug in OneOfImplementorAdditionalData pulling in wrong vars to one-of-implementors.
Support parentVars in order to support fluent setter with inherited properties.

Squashed commit of the following:

commit f945c943777a1a496d7de8fc0a188842d9efb1ac
Author: Lars Uffmann <lars.uffmann@gmail.com>
Date:   Thu Apr 7 18:22:54 2022 +0200

    Polishing

commit 23ce1d0ff1faff53e85ca4362f33660962aa6a92
Author: Lars Uffmann <lars.uffmann@vitroconnect.de>
Date:   Thu Apr 7 17:15:28 2022 +0200

    Add JavaDoc

commit fee70fde5709afa67f3aabd4f48ba496df63a884
Author: Lars Uffmann <lars.uffmann@vitroconnect.de>
Date:   Thu Apr 7 17:11:17 2022 +0200

    Add imports for inherited Properties

commit 29509aaac51750fbd33c00a57d32cac34cbcbb90
Author: Lars Uffmann <lars.uffmann@vitroconnect.de>
Date:   Thu Apr 7 13:40:36 2022 +0200

    Generate Samples

commit 1d19d5465137d3af712f2fd3b4ae4474c58af15e
Author: Lars Uffmann <lars.uffmann@vitroconnect.de>
Date:   Thu Apr 7 13:21:23 2022 +0200

    SpringCodegen: Support parentVars in order to support fluent setter with inherited properties.

commit 2217a77bb747d0b07ef17407a6b5dd5c624a2551
Author: Lars Uffmann <lars.uffmann@gmail.com>
Date:   Thu Apr 7 07:18:50 2022 +0200

    Add allVars to omit list in OneOfImplementorAdditionalData

commit 90499a3b0a187971bfe25deb6355c3444dcf89a7
Author: Lars Uffmann <lars.uffmann@gmail.com>
Date:   Wed Apr 6 16:40:23 2022 +0200

    Works exactly as needed for oneOf/allOf in Java/Spring

commit b6d496d772e0d0a8d87a3b8cdba8fd3ca4db7f3f
Author: Lars Uffmann <lars.uffmann@gmail.com>
Date:   Wed Apr 6 15:16:27 2022 +0200

    Debug Session: identify critical codep path

commit 85722360038107f15841d5acc448d93dee513a06
Author: Lars Uffmann <lars.uffmann@vitroconnect.de>
Date:   Tue Apr 5 09:56:38 2022 +0200

    Add test case to reproduce issue.

commit 14acc5cd974bb5260f3751015558807e2eb1a8a1
Author: Lars Uffmann <lars.uffmann@gmail.com>
Date:   Tue Apr 5 06:57:30 2022 +0200

    Add config to reproduce the issue

* Adjust indentation.

Co-authored-by: Lars Uffmann <lars@wintermute.local>
This commit is contained in:
cachescrubber
2022-04-16 10:48:14 +02:00
committed by GitHub
parent e12100b033
commit f195a83aaf
76 changed files with 1431 additions and 222 deletions

View File

@@ -989,17 +989,17 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("CodegenModel{");
sb.append("parent='").append(parent).append('\'');
sb.append("name='").append(name).append('\'');
sb.append(", parent='").append(parent).append('\'');
sb.append(", parentSchema='").append(parentSchema).append('\'');
sb.append(", interfaces=").append(interfaces);
sb.append(", interfaceModels=").append(interfaceModels!=null?interfaceModels.size():"[]");
sb.append(", allParents=").append(allParents);
sb.append(", parentModel=").append(parentModel);
sb.append(", interfaceModels=").append(interfaceModels);
sb.append(", children=").append(children);
sb.append(", children=").append(children!=null?children.size():"[]");
sb.append(", anyOf=").append(anyOf);
sb.append(", oneOf=").append(oneOf);
sb.append(", allOf=").append(allOf);
sb.append(", name='").append(name).append('\'');
sb.append(", classname='").append(classname).append('\'');
sb.append(", title='").append(title).append('\'');
sb.append(", description='").append(description).append('\'');

View File

@@ -3193,7 +3193,7 @@ public class DefaultCodegen implements CodegenConfig {
// FIXME: for now, we assume that the discriminator property is String
discriminator.setPropertyType(typeMapping.get("string"));
discriminator.setMapping(sourceDiscriminator.getMapping());
List<MappedModel> uniqueDescendants = new ArrayList();
List<MappedModel> uniqueDescendants = new ArrayList<>();
if (sourceDiscriminator.getMapping() != null && !sourceDiscriminator.getMapping().isEmpty()) {
for (Entry<String, String> e : sourceDiscriminator.getMapping().entrySet()) {
String name;

View File

@@ -32,9 +32,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Pair;
@@ -884,9 +887,67 @@ public class SpringCodegen extends AbstractJavaCodegen
codegenModel.imports.remove("ApiModelProperty");
codegenModel.imports.remove("ApiModel");
}
return codegenModel;
}
/**
* Analyse and post process all Models.
* Add parentVars to every Model which has a parent. This allows to generate
* fluent setter methods for inherited properties.
* @param objs the models map.
* @return the processed models map.
*/
@Override
public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs) {
objs = super.postProcessAllModels(objs);
objs = super.updateAllModels(objs);
for (ModelsMap modelsAttrs : objs.values()) {
for (ModelMap mo : modelsAttrs.getModels()) {
CodegenModel codegenModel = mo.getModel();
Set<String> inheritedImports = new HashSet<>();
Map<String, CodegenProperty> propertyHash = new HashMap<>(codegenModel.vars.size());
for (final CodegenProperty property : codegenModel.vars) {
propertyHash.put(property.name, property);
}
CodegenModel parentCodegenModel = codegenModel.parentModel;
while (parentCodegenModel != null) {
for (final CodegenProperty property : parentCodegenModel.vars) {
// helper list of parentVars simplifies templating
if (!propertyHash.containsKey(property.name)) {
propertyHash.put(property.name, property);
final CodegenProperty parentVar = property.clone();
parentVar.isInherited = true;
LOGGER.info("adding parent variable {}", property.name);
codegenModel.parentVars.add(parentVar);
Set<String> imports = parentVar.getImports(true).stream().filter(Objects::nonNull).collect(Collectors.toSet());
for (String imp: imports) {
// Avoid dupes
if (!codegenModel.getImports().contains(imp)) {
inheritedImports.add(imp);
codegenModel.getImports().add(imp);
}
}
}
}
parentCodegenModel = parentCodegenModel.getParentModel();
}
// There must be a better way ...
for (String imp: inheritedImports) {
String qimp = importMapping().get(imp);
if (qimp != null) {
Map<String,String> toAdd = new HashMap<>();
toAdd.put("import", qimp);
modelsAttrs.getImports().add(toAdd);
}
}
}
}
return objs;
}
/*
* Add dynamic imports based on the parameters and vendor extensions of an operation.
* The imports are expanded by the mustache {{import}} tag available to model and api

View File

@@ -1,16 +1,17 @@
package org.openapitools.codegen.utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.openapitools.codegen.CodegenConfig;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* This class holds data to add to `oneOf` members. Let's consider this example:
*
@@ -69,15 +70,19 @@ public class OneOfImplementorAdditionalData {
// Add all vars defined on cm
// a "oneOf" model (cm) by default inherits all properties from its "interfaceModels",
// but we only want to add properties defined on cm itself
List<CodegenProperty> toAdd = new ArrayList<CodegenProperty>(cm.vars);
List<CodegenProperty> toAdd = new ArrayList<>(cm.vars);
// note that we can't just toAdd.removeAll(m.vars) for every interfaceModel,
// as they might have different value of `hasMore` and thus are not equal
List<String> omitAdding = new ArrayList<String>();
Set<String> omitAdding = new HashSet<>();
if (cm.interfaceModels != null) {
for (CodegenModel m : cm.interfaceModels) {
for (CodegenProperty v : m.vars) {
omitAdding.add(v.baseName);
}
for (CodegenProperty v : m.allVars) {
omitAdding.add(v.baseName);
}
}
}
for (CodegenProperty v : toAdd) {
@@ -89,7 +94,7 @@ public class OneOfImplementorAdditionalData {
// Add all imports of cm
for (Map<String, String> importMap : modelsImports) {
// we're ok with shallow clone here, because imports are strings only
additionalImports.add(new HashMap<String, String>(importMap));
additionalImports.add(new HashMap<>(importMap));
}
}
@@ -120,6 +125,7 @@ public class OneOfImplementorAdditionalData {
// Add oneOf-containing models properties - we need to properly set the hasMore values to make rendering correct
implcm.vars.addAll(additionalProps);
implcm.hasVars = ! implcm.vars.isEmpty();
// Add imports
for (Map<String, String> oneImport : additionalImports) {

View File

@@ -164,6 +164,29 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
}
{{! end feature: getter and setter }}
{{/vars}}
{{#parentVars}}
{{! begin feature: fluent setter methods for inherited properties }}
public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) {
super.{{setter}}({{name}});
return this;
}
{{#isArray}}
public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) {
super.add{{nameInCamelCase}}Item({{name}}Item);
return this;
}
{{/isArray}}
{{#isMap}}
public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) {
super.put{{nameInCamelCase}}Item({{name}}Item);
return this;
}
{{/isMap}}
{{! end feature: fluent setter methods for inherited properties }}
{{/parentVars}}
@Override
public boolean equals(Object o) {
@@ -178,23 +201,27 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{^parent}}
{{/-last}}{{/vars}}{{#parent}} &&
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
return true;{{/hasVars}}
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
}
{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
}
{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
@Override
public int hashCode() {
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
}
{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
}
{{/vendorExtensions.x-jackson-optional-nullable-helpers}}
@Override
public String toString() {

View File

@@ -987,6 +987,49 @@ public class SpringCodegenTest {
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRefOrValue.java"), "public interface FooRefOrValue");
}
@Test
public void oneOf_allOf() 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/oneof_polymorphism_and_inheritance.yaml", null, new ParseOptions()).getOpenAPI();
SpringCodegen codegen = new SpringCodegen();
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true");
codegen.setUseOneOfInterfaces(true);
ClientOptInput input = new ClientOptInput();
input.openAPI(openAPI);
input.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
codegen.setHateoas(true);
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true");
// generator.setGeneratorPropertyDefault(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "false");
codegen.setUseOneOfInterfaces(true);
codegen.setLegacyDiscriminatorBehavior(false);
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();
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/Foo.java"), "public class Foo extends Entity implements FooRefOrValue");
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRef.java"), "public class FooRef extends EntityRef implements FooRefOrValue");
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/FooRefOrValue.java"), "public interface FooRefOrValue");
// previous bugs
assertFileNotContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/BarRef.java"), "atTypesuper.hashCode");
assertFileNotContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/BarRef.java"), "private String atBaseType");
// imports for inherited properties
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/model/PizzaSpeziale.java"), "import java.math.BigDecimal");
}
@Test
public void testTypeMappings() {
final SpringCodegen codegen = new SpringCodegen();

View File

@@ -116,13 +116,15 @@ components:
- $ref: '#/components/schemas/Entity'
FooRef:
type: object
discriminator:
propertyName: '@type'
properties:
foorefPropA:
type: string
allOf:
- $ref: '#/components/schemas/EntityRef'
BarRef:
type: object
allOf:
- $ref: '#/components/schemas/EntityRef'
Bar_Create:
type: object
properties:
@@ -149,6 +151,32 @@ components:
$ref: '#/components/schemas/FooRefOrValue'
allOf:
- $ref: '#/components/schemas/Entity'
BarRefOrValue:
type: object
oneOf:
- $ref: "#/components/schemas/Bar"
- $ref: "#/components/schemas/BarRef"
Pizza:
type: object
properties:
pizzaSize:
type: number
allOf:
- $ref: '#/components/schemas/Entity'
Pasta:
type: object
properties:
vendor:
type: string
allOf:
- $ref: '#/components/schemas/Entity'
PizzaSpeziale:
type: object
properties:
toppings:
type: string
allOf:
- $ref: '#/components/schemas/Pizza'
requestBodies:
Foo:

View File

@@ -89,6 +89,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -58,6 +58,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -49,6 +49,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -11,12 +11,17 @@ src/main/java/org/openapitools/configuration/HomeController.java
src/main/java/org/openapitools/model/Addressable.java
src/main/java/org/openapitools/model/Bar.java
src/main/java/org/openapitools/model/BarCreate.java
src/main/java/org/openapitools/model/BarRef.java
src/main/java/org/openapitools/model/BarRefOrValue.java
src/main/java/org/openapitools/model/Entity.java
src/main/java/org/openapitools/model/EntityRef.java
src/main/java/org/openapitools/model/Extensible.java
src/main/java/org/openapitools/model/Foo.java
src/main/java/org/openapitools/model/FooRef.java
src/main/java/org/openapitools/model/FooRefOrValue.java
src/main/java/org/openapitools/model/Pasta.java
src/main/java/org/openapitools/model/Pizza.java
src/main/java/org/openapitools/model/PizzaSpeziale.java
src/main/resources/application.properties
src/main/resources/openapi.yaml
src/test/java/org/openapitools/OpenApiGeneratorApplicationTests.java

View File

@@ -25,7 +25,7 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Bar extends Entity {
public class Bar extends Entity implements BarRefOrValue {
@JsonProperty("id")
private String id;
@@ -115,6 +115,26 @@ public class Bar extends Entity {
this.foo = foo;
}
public Bar href(String href) {
super.setHref(href);
return this;
}
public Bar atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}
public Bar atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}
public Bar atType(String atType) {
super.setAtType(atType);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -95,6 +95,31 @@ public class BarCreate extends Entity {
this.foo = foo;
}
public BarCreate href(String href) {
super.setHref(href);
return this;
}
public BarCreate id(String id) {
super.setId(id);
return this;
}
public BarCreate atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}
public BarCreate atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}
public BarCreate atType(String atType) {
super.setAtType(atType);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -0,0 +1,100 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.openapitools.model.EntityRef;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* BarRef
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class BarRef extends EntityRef implements BarRefOrValue {
public BarRef name(String name) {
super.setName(name);
return this;
}
public BarRef atReferredType(String atReferredType) {
super.setAtReferredType(atReferredType);
return this;
}
public BarRef href(String href) {
super.setHref(href);
return this;
}
public BarRef id(String id) {
super.setId(id);
return this;
}
public BarRef atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}
public BarRef atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}
public BarRef atType(String atType) {
super.setAtType(atType);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BarRef {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,36 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.openapitools.model.Bar;
import org.openapitools.model.BarRef;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
@JsonIgnoreProperties(
value = "@type", // ignore manually set @type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the @type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = Bar.class, name = "Bar"),
@JsonSubTypes.Type(value = BarRef.class, name = "BarRef")
})
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public interface BarRefOrValue {
public String getAtType();
}

View File

@@ -12,6 +12,9 @@ import org.openapitools.model.Bar;
import org.openapitools.model.BarCreate;
import org.openapitools.model.Extensible;
import org.openapitools.model.Foo;
import org.openapitools.model.Pasta;
import org.openapitools.model.Pizza;
import org.openapitools.model.PizzaSpeziale;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
@@ -34,7 +37,10 @@ import javax.annotation.Generated;
@JsonSubTypes({
@JsonSubTypes.Type(value = Bar.class, name = "Bar"),
@JsonSubTypes.Type(value = BarCreate.class, name = "Bar_Create"),
@JsonSubTypes.Type(value = Foo.class, name = "Foo")
@JsonSubTypes.Type(value = Foo.class, name = "Foo"),
@JsonSubTypes.Type(value = Pasta.class, name = "Pasta"),
@JsonSubTypes.Type(value = Pizza.class, name = "Pizza"),
@JsonSubTypes.Type(value = PizzaSpeziale.class, name = "PizzaSpeziale")
})
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")

View File

@@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.openapitools.model.Addressable;
import org.openapitools.model.BarRef;
import org.openapitools.model.Extensible;
import org.openapitools.model.FooRef;
import org.openapitools.jackson.nullable.JsonNullable;
@@ -31,6 +32,7 @@ import javax.annotation.Generated;
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = BarRef.class, name = "BarRef"),
@JsonSubTypes.Type(value = FooRef.class, name = "FooRef")
})

View File

@@ -32,21 +32,6 @@ public class Foo extends Entity implements FooRefOrValue {
@JsonProperty("fooPropB")
private String fooPropB;
@JsonProperty("href")
private String href;
@JsonProperty("id")
private String id;
@JsonProperty("@schemaLocation")
private String atSchemaLocation;
@JsonProperty("@baseType")
private String atBaseType;
@JsonProperty("@type")
private String atType;
public Foo fooPropA(String fooPropA) {
this.fooPropA = fooPropA;
return this;
@@ -86,100 +71,30 @@ public class Foo extends Entity implements FooRefOrValue {
}
public Foo href(String href) {
this.href = href;
super.setHref(href);
return this;
}
/**
* Hyperlink reference
* @return href
*/
@Schema(name = "href", description = "Hyperlink reference", required = false)
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public Foo id(String id) {
this.id = id;
super.setId(id);
return this;
}
/**
* unique identifier
* @return id
*/
@Schema(name = "id", description = "unique identifier", required = false)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Foo atSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
super.setAtSchemaLocation(atSchemaLocation);
return this;
}
/**
* A URI to a JSON-Schema file that defines additional attributes and relationships
* @return atSchemaLocation
*/
@Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false)
public String getAtSchemaLocation() {
return atSchemaLocation;
}
public void setAtSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
}
public Foo atBaseType(String atBaseType) {
this.atBaseType = atBaseType;
super.setAtBaseType(atBaseType);
return this;
}
/**
* When sub-classing, this defines the super-class
* @return atBaseType
*/
@Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false)
public String getAtBaseType() {
return atBaseType;
}
public void setAtBaseType(String atBaseType) {
this.atBaseType = atBaseType;
}
public Foo atType(String atType) {
this.atType = atType;
super.setAtType(atType);
return this;
}
/**
* When sub-classing, this defines the sub-class Extensible name
* @return atType
*/
@NotNull
@Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true)
public String getAtType() {
return atType;
}
public void setAtType(String atType) {
this.atType = atType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -191,17 +106,12 @@ public class Foo extends Entity implements FooRefOrValue {
Foo foo = (Foo) o;
return Objects.equals(this.fooPropA, foo.fooPropA) &&
Objects.equals(this.fooPropB, foo.fooPropB) &&
Objects.equals(this.href, foo.href) &&
Objects.equals(this.id, foo.id) &&
Objects.equals(this.atSchemaLocation, foo.atSchemaLocation) &&
Objects.equals(this.atBaseType, foo.atBaseType) &&
Objects.equals(this.atType, foo.atType) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(fooPropA, fooPropB, href, id, atSchemaLocation, atBaseType, atType, super.hashCode());
return Objects.hash(fooPropA, fooPropB, super.hashCode());
}
@Override
@@ -211,11 +121,6 @@ public class Foo extends Entity implements FooRefOrValue {
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" fooPropA: ").append(toIndentedString(fooPropA)).append("\n");
sb.append(" fooPropB: ").append(toIndentedString(fooPropB)).append("\n");
sb.append(" href: ").append(toIndentedString(href)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n");
sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n");
sb.append(" atType: ").append(toIndentedString(atType)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@@ -29,21 +29,6 @@ public class FooRef extends EntityRef implements FooRefOrValue {
@JsonProperty("foorefPropA")
private String foorefPropA;
@JsonProperty("href")
private String href;
@JsonProperty("id")
private String id;
@JsonProperty("@schemaLocation")
private String atSchemaLocation;
@JsonProperty("@baseType")
private String atBaseType;
@JsonProperty("@type")
private String atType;
public FooRef foorefPropA(String foorefPropA) {
this.foorefPropA = foorefPropA;
return this;
@@ -63,101 +48,41 @@ public class FooRef extends EntityRef implements FooRefOrValue {
this.foorefPropA = foorefPropA;
}
public FooRef href(String href) {
this.href = href;
public FooRef name(String name) {
super.setName(name);
return this;
}
/**
* Hyperlink reference
* @return href
*/
@Schema(name = "href", description = "Hyperlink reference", required = false)
public String getHref() {
return href;
public FooRef atReferredType(String atReferredType) {
super.setAtReferredType(atReferredType);
return this;
}
public void setHref(String href) {
this.href = href;
public FooRef href(String href) {
super.setHref(href);
return this;
}
public FooRef id(String id) {
this.id = id;
super.setId(id);
return this;
}
/**
* unique identifier
* @return id
*/
@Schema(name = "id", description = "unique identifier", required = false)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public FooRef atSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
super.setAtSchemaLocation(atSchemaLocation);
return this;
}
/**
* A URI to a JSON-Schema file that defines additional attributes and relationships
* @return atSchemaLocation
*/
@Schema(name = "@schemaLocation", description = "A URI to a JSON-Schema file that defines additional attributes and relationships", required = false)
public String getAtSchemaLocation() {
return atSchemaLocation;
}
public void setAtSchemaLocation(String atSchemaLocation) {
this.atSchemaLocation = atSchemaLocation;
}
public FooRef atBaseType(String atBaseType) {
this.atBaseType = atBaseType;
super.setAtBaseType(atBaseType);
return this;
}
/**
* When sub-classing, this defines the super-class
* @return atBaseType
*/
@Schema(name = "@baseType", description = "When sub-classing, this defines the super-class", required = false)
public String getAtBaseType() {
return atBaseType;
}
public void setAtBaseType(String atBaseType) {
this.atBaseType = atBaseType;
}
public FooRef atType(String atType) {
this.atType = atType;
super.setAtType(atType);
return this;
}
/**
* When sub-classing, this defines the sub-class Extensible name
* @return atType
*/
@NotNull
@Schema(name = "@type", description = "When sub-classing, this defines the sub-class Extensible name", required = true)
public String getAtType() {
return atType;
}
public void setAtType(String atType) {
this.atType = atType;
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -168,17 +93,12 @@ public class FooRef extends EntityRef implements FooRefOrValue {
}
FooRef fooRef = (FooRef) o;
return Objects.equals(this.foorefPropA, fooRef.foorefPropA) &&
Objects.equals(this.href, fooRef.href) &&
Objects.equals(this.id, fooRef.id) &&
Objects.equals(this.atSchemaLocation, fooRef.atSchemaLocation) &&
Objects.equals(this.atBaseType, fooRef.atBaseType) &&
Objects.equals(this.atType, fooRef.atType) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(foorefPropA, href, id, atSchemaLocation, atBaseType, atType, super.hashCode());
return Objects.hash(foorefPropA, super.hashCode());
}
@Override
@@ -187,11 +107,6 @@ public class FooRef extends EntityRef implements FooRefOrValue {
sb.append("class FooRef {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" foorefPropA: ").append(toIndentedString(foorefPropA)).append("\n");
sb.append(" href: ").append(toIndentedString(href)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" atSchemaLocation: ").append(toIndentedString(atSchemaLocation)).append("\n");
sb.append(" atBaseType: ").append(toIndentedString(atBaseType)).append("\n");
sb.append(" atType: ").append(toIndentedString(atType)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@@ -0,0 +1,115 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.openapitools.model.Entity;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* Pasta
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Pasta extends Entity {
@JsonProperty("vendor")
private String vendor;
public Pasta vendor(String vendor) {
this.vendor = vendor;
return this;
}
/**
* Get vendor
* @return vendor
*/
@Schema(name = "vendor", required = false)
public String getVendor() {
return vendor;
}
public void setVendor(String vendor) {
this.vendor = vendor;
}
public Pasta href(String href) {
super.setHref(href);
return this;
}
public Pasta id(String id) {
super.setId(id);
return this;
}
public Pasta atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}
public Pasta atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}
public Pasta atType(String atType) {
super.setAtType(atType);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pasta pasta = (Pasta) o;
return Objects.equals(this.vendor, pasta.vendor) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(vendor, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Pasta {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" vendor: ").append(toIndentedString(vendor)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,125 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.math.BigDecimal;
import org.openapitools.model.Entity;
import org.openapitools.model.PizzaSpeziale;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* Pizza
*/
@JsonIgnoreProperties(
value = "@type", // ignore manually set @type, it will be automatically generated by Jackson during serialization
allowSetters = true // allows the @type to be set during deserialization
)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "@type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = PizzaSpeziale.class, name = "PizzaSpeziale")
})
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class Pizza extends Entity {
@JsonProperty("pizzaSize")
private BigDecimal pizzaSize;
public Pizza pizzaSize(BigDecimal pizzaSize) {
this.pizzaSize = pizzaSize;
return this;
}
/**
* Get pizzaSize
* @return pizzaSize
*/
@Valid
@Schema(name = "pizzaSize", required = false)
public BigDecimal getPizzaSize() {
return pizzaSize;
}
public void setPizzaSize(BigDecimal pizzaSize) {
this.pizzaSize = pizzaSize;
}
public Pizza href(String href) {
super.setHref(href);
return this;
}
public Pizza id(String id) {
super.setId(id);
return this;
}
public Pizza atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}
public Pizza atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}
public Pizza atType(String atType) {
super.setAtType(atType);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Pizza pizza = (Pizza) o;
return Objects.equals(this.pizzaSize, pizza.pizzaSize) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(pizzaSize, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Pizza {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" pizzaSize: ").append(toIndentedString(pizzaSize)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,121 @@
package org.openapitools.model;
import java.net.URI;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.openapitools.model.Pizza;
import java.math.BigDecimal;
import org.openapitools.jackson.nullable.JsonNullable;
import java.time.OffsetDateTime;
import javax.validation.Valid;
import javax.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.*;
import javax.annotation.Generated;
/**
* PizzaSpeziale
*/
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
public class PizzaSpeziale extends Pizza {
@JsonProperty("toppings")
private String toppings;
public PizzaSpeziale toppings(String toppings) {
this.toppings = toppings;
return this;
}
/**
* Get toppings
* @return toppings
*/
@Schema(name = "toppings", required = false)
public String getToppings() {
return toppings;
}
public void setToppings(String toppings) {
this.toppings = toppings;
}
public PizzaSpeziale pizzaSize(BigDecimal pizzaSize) {
super.setPizzaSize(pizzaSize);
return this;
}
public PizzaSpeziale href(String href) {
super.setHref(href);
return this;
}
public PizzaSpeziale id(String id) {
super.setId(id);
return this;
}
public PizzaSpeziale atSchemaLocation(String atSchemaLocation) {
super.setAtSchemaLocation(atSchemaLocation);
return this;
}
public PizzaSpeziale atBaseType(String atBaseType) {
super.setAtBaseType(atBaseType);
return this;
}
public PizzaSpeziale atType(String atType) {
super.setAtType(atType);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PizzaSpeziale pizzaSpeziale = (PizzaSpeziale) o;
return Objects.equals(this.toppings, pizzaSpeziale.toppings) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(toppings, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PizzaSpeziale {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" toppings: ").append(toIndentedString(toppings)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -166,12 +166,14 @@ components:
FooRef:
allOf:
- $ref: '#/components/schemas/EntityRef'
discriminator:
propertyName: '@type'
properties:
foorefPropA:
type: string
type: object
BarRef:
allOf:
- $ref: '#/components/schemas/EntityRef'
type: object
Bar_Create:
allOf:
- $ref: '#/components/schemas/Entity'
@@ -203,3 +205,30 @@ components:
required:
- id
type: object
BarRefOrValue:
oneOf:
- $ref: '#/components/schemas/Bar'
- $ref: '#/components/schemas/BarRef'
type: object
x-one-of-name: BarRefOrValue
Pizza:
allOf:
- $ref: '#/components/schemas/Entity'
properties:
pizzaSize:
type: number
type: object
Pasta:
allOf:
- $ref: '#/components/schemas/Entity'
properties:
vendor:
type: string
type: object
PizzaSpeziale:
allOf:
- $ref: '#/components/schemas/Pizza'
properties:
toppings:
type: string
type: object

View File

@@ -88,6 +88,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -57,6 +57,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -48,6 +48,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -89,6 +89,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -58,6 +58,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -49,6 +49,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -89,6 +89,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -58,6 +58,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -49,6 +49,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -89,6 +89,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -58,6 +58,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -49,6 +49,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -89,6 +89,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -58,6 +58,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -49,6 +49,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -89,6 +89,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -58,6 +58,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -49,6 +49,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -89,6 +89,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -58,6 +58,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -49,6 +49,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -90,6 +90,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -59,6 +59,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -90,6 +90,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -59,6 +59,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -90,6 +90,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -59,6 +59,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -90,6 +90,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -59,6 +59,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -90,6 +90,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -59,6 +59,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -90,6 +90,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -59,6 +59,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -90,6 +90,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -59,6 +59,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -90,6 +90,21 @@ public class BigCat extends Cat {
this.kind = kind;
}
public BigCat declawed(Boolean declawed) {
super.setDeclawed(declawed);
return this;
}
public BigCat className(String className) {
super.setClassName(className);
return this;
}
public BigCat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -59,6 +59,16 @@ public class Cat extends Animal {
this.declawed = declawed;
}
public Cat className(String className) {
super.setClassName(className);
return this;
}
public Cat color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {

View File

@@ -50,6 +50,16 @@ public class Dog extends Animal {
this.breed = breed;
}
public Dog className(String className) {
super.setClassName(className);
return this;
}
public Dog color(String color) {
super.setColor(color);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {