Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non functional Java styling changes #10808

Merged
merged 9 commits into from
Nov 9, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static CodegenConfig forName(String name) {
try {
return (CodegenConfig) Class.forName(name).getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new GeneratorNotFoundException("Can't load config class with name '".concat(name) + "'\nAvailable:\n" + availableConfigs.toString(), e);
throw new GeneratorNotFoundException("Can't load config class with name '".concat(name) + "'\nAvailable:\n" + availableConfigs, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public List<CodegenModel> children;

// anyOf, oneOf, allOf
public Set<String> anyOf = new TreeSet<String>();
public Set<String> oneOf = new TreeSet<String>();
public Set<String> allOf = new TreeSet<String>();
public Set<String> anyOf = new TreeSet<>();
public Set<String> oneOf = new TreeSet<>();
public Set<String> allOf = new TreeSet<>();

// The schema name as written in the OpenAPI document.
public String name;
Expand All @@ -66,20 +66,20 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public boolean isAlias; // Is this effectively an alias of another simple type
public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime, isShort, isUnboundedInteger, isBoolean;
private boolean additionalPropertiesIsAnyType;
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); // all properties (without parent's properties)
public List<CodegenProperty> allVars = new ArrayList<CodegenProperty>(); // all properties (with parent's properties)
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
public List<CodegenProperty> readOnlyVars = new ArrayList<CodegenProperty>(); // a list of read-only properties
public List<CodegenProperty> readWriteVars = new ArrayList<CodegenProperty>(); // a list of properties for read, write
public List<CodegenProperty> parentVars = new ArrayList<CodegenProperty>();
public List<CodegenProperty> vars = new ArrayList<>(); // all properties (without parent's properties)
public List<CodegenProperty> allVars = new ArrayList<>(); // all properties (with parent's properties)
public List<CodegenProperty> requiredVars = new ArrayList<>(); // a list of required properties
public List<CodegenProperty> optionalVars = new ArrayList<>(); // a list of optional properties
public List<CodegenProperty> readOnlyVars = new ArrayList<>(); // a list of read-only properties
public List<CodegenProperty> readWriteVars = new ArrayList<>(); // a list of properties for read, write
public List<CodegenProperty> parentVars = new ArrayList<>();
public Map<String, Object> allowableValues;

// Sorted sets of required parameters.
public Set<String> mandatory = new TreeSet<String>(); // without parent's required properties
public Set<String> allMandatory = new TreeSet<String>(); // with parent's required properties
public Set<String> mandatory = new TreeSet<>(); // without parent's required properties
public Set<String> allMandatory = new TreeSet<>(); // with parent's required properties

public Set<String> imports = new TreeSet<String>();
public Set<String> imports = new TreeSet<>();
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasValidation;
/**
* Indicates the OAS schema specifies "nullable: true".
Expand All @@ -104,7 +104,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public boolean hasOnlyReadOnly = true; // true if all properties are read-only
public ExternalDocumentation externalDocumentation;

public Map<String, Object> vendorExtensions = new HashMap<String, Object>();
public Map<String, Object> vendorExtensions = new HashMap<>();
private CodegenComposedSchemas composedSchemas;
private boolean hasMultipleTypes = false;

Expand Down Expand Up @@ -320,7 +320,7 @@ public CodegenDiscriminator getDiscriminator() {

public void setDiscriminator(CodegenDiscriminator discriminator) {
this.discriminator = discriminator;
if (discriminator instanceof CodegenDiscriminator && !discriminator.getMappedModels().isEmpty()) {
if (discriminator != null && !discriminator.getMappedModels().isEmpty()) {
this.hasDiscriminatorWithNonEmptyMapping = true;
}
}
Expand Down Expand Up @@ -1067,13 +1067,13 @@ public void removeAllDuplicatedProperty() {

private List<CodegenProperty> removeDuplicatedProperty(List<CodegenProperty> vars) {
// clone the list first
List<CodegenProperty> newList = new ArrayList<CodegenProperty>();
List<CodegenProperty> newList = new ArrayList<>();
for (CodegenProperty cp : vars) {
newList.add(cp.clone());
}

Set<String> propertyNames = new TreeSet<String>();
Set<String> duplicatedNames = new TreeSet<String>();
Set<String> propertyNames = new TreeSet<>();
Set<String> duplicatedNames = new TreeSet<>();

ListIterator<CodegenProperty> iterator = newList.listIterator();
while (iterator.hasNext()) {
Expand Down
Loading