mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-06 10:26:14 +00:00
Better code format for Java (okhttp-gson) client (#971)
* better code format for java okhttp client * update java petstore samples
This commit is contained in:
@@ -24,13 +24,17 @@ public class Pair {
|
||||
}
|
||||
|
||||
private void setName(String name) {
|
||||
if (!isValidString(name)) return;
|
||||
if (!isValidString(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
private void setValue(String value) {
|
||||
if (!isValidString(value)) return;
|
||||
if (!isValidString(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.value = value;
|
||||
}
|
||||
@@ -44,8 +48,13 @@ public class Pair {
|
||||
}
|
||||
|
||||
private boolean isValidString(String arg) {
|
||||
if (arg == null) return false;
|
||||
if (arg.trim().isEmpty()) return false;
|
||||
if (arg == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (arg.trim().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,12 @@ public class StringUtil {
|
||||
*/
|
||||
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||
for (String str : array) {
|
||||
if (value == null && str == null) return true;
|
||||
if (value != null && value.equalsIgnoreCase(str)) return true;
|
||||
if (value == null && str == null) {
|
||||
return true;
|
||||
}
|
||||
if (value != null && value.equalsIgnoreCase(str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -43,7 +47,9 @@ public class StringUtil {
|
||||
*/
|
||||
public static String join(String[] array, String separator) {
|
||||
int len = array.length;
|
||||
if (len == 0) return "";
|
||||
if (len == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append(array[0]);
|
||||
|
||||
Reference in New Issue
Block a user