mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-07 03:56:08 +00:00
immutable Pair, better performant HttpBearerAuth, consistent code-style (#20743)
* make Pair immutable and in google-code-style * apply google-code-style to JavaTimeFormatter (to make it consistent with most other auto-generated java) * move upperCaseBearer to ctor (scheme is final and private; only needs to be fixed once); also replaced Optional with ternary (perf and cleaner code) * apply google-code-style to Authentication to make it consistent with rest of auth code * fresh samples
This commit is contained in:
@@ -15,43 +15,23 @@ package org.openapitools.client;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Pair {
|
||||
private String name = "";
|
||||
private String value = "";
|
||||
private final String name;
|
||||
private final String value;
|
||||
|
||||
public Pair (String name, String value) {
|
||||
setName(name);
|
||||
setValue(value);
|
||||
}
|
||||
public Pair(String name, String value) {
|
||||
this.name = isValidString(name) ? name : "";
|
||||
this.value = isValidString(value) ? value : "";
|
||||
}
|
||||
|
||||
private void setName(String name) {
|
||||
if (!isValidString(name)) {
|
||||
return;
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private void setValue(String value) {
|
||||
if (!isValidString(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private boolean isValidString(String arg) {
|
||||
if (arg == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private static boolean isValidString(String arg) {
|
||||
return arg != null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user