Prefer getter types over field types
This commit is contained in:
parent
a69f1c07bd
commit
9f32d3b25d
|
@ -8,6 +8,9 @@ import java.io.IOException;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utility class for generating lists, to be used when data with an array root element
|
||||
*/
|
||||
public class GList {
|
||||
public static <T> List<T> read(JsonReader reader, ThrowingFunction<JsonReader, T, IOException> read) throws IOException {
|
||||
if (reader.isLenient() && reader.peek() != JsonToken.BEGIN_ARRAY) return List.of(read.apply(reader));
|
||||
|
|
|
@ -35,6 +35,16 @@ public class Main {
|
|||
|
||||
public EeE eEe;
|
||||
|
||||
public UnsupportedClass unsupported;
|
||||
|
||||
public String getUnsupported() {
|
||||
return unsupported == null ? null : unsupported.text;
|
||||
}
|
||||
|
||||
public void setUnsupported(String text) {
|
||||
unsupported = new UnsupportedClass(text);
|
||||
}
|
||||
|
||||
public void setJoe(String joe) {
|
||||
}
|
||||
|
||||
|
@ -87,4 +97,12 @@ public class Main {
|
|||
public enum EeE {
|
||||
Yes, Yay, Aaee;
|
||||
}
|
||||
|
||||
public static class UnsupportedClass {
|
||||
private final String text;
|
||||
|
||||
public UnsupportedClass(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -163,9 +163,9 @@ public class Properties extends DelegateList<Property<?>> {
|
|||
mergeSerializeNames(params, fields, getters, setters);
|
||||
removeExtraFields();
|
||||
names.addAll(params);
|
||||
fields.stream().filter(f -> !containsName(names, f)).forEach(names::add);
|
||||
getters.stream().filter(f -> !containsName(names, f)).forEach(names::add);
|
||||
setters.stream().filter(f -> !containsName(names, f)).forEach(names::add);
|
||||
fields.stream().filter(f -> !containsName(names, f)).forEach(names::add);
|
||||
return new Properties(names, params, fields, getters, setters, constructorParams, builderParams);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue