diff --git a/README.md b/README.md index dc6d997..412481c 100644 --- a/README.md +++ b/README.md @@ -299,7 +299,7 @@ In this case, we remove the previous object and stop if the new one is null. Otherwise, we create the corresponding section and save the desired into it: ```java @Override - protected TriConsumer<@NotNull IConfiguration, @NotNull String, @NotNull Person> getDumper() { + protected TriConsumer getDumper() { return (configuration, path, person) -> { if (configuration == null || path == null) return; if (person == null) return; @@ -315,7 +315,7 @@ Otherwise, load the name and the age and create a new person with these values ( **It is up to the user to handle any exception accordingly**, for example if age was null): ```java @Override - protected BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable Person> getLoader() { + protected BiFunctionException getLoader() { return (configuration, path) -> { if (configuration == null || path == null) return null; ConfigurationSection personSection = configuration.getConfigurationSection(path); diff --git a/build.gradle b/build.gradle index e0cdd1d..5c6519e 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { } group = 'it.fulminazzo' -version = '1.5.12' +version = '1.5.13' repositories { mavenCentral() diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/ArrayYAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/ArrayYAMLParser.java index 674663c..09e917f 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/ArrayYAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/ArrayYAMLParser.java @@ -5,7 +5,6 @@ import it.fulminazzo.fulmicollection.interfaces.functions.BiFunctionException; import it.fulminazzo.fulmicollection.interfaces.functions.TriConsumer; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.lang.reflect.Array; import java.util.Arrays; @@ -35,7 +34,7 @@ public ArrayYAMLParser() { * @return the loader */ @Override - protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable T[]> getLoader() { + protected @NotNull BiFunctionException getLoader() { return (c, s) -> { List tmp = listYamlParser.load(c, s); if (tmp == null) return null; @@ -53,7 +52,7 @@ public ArrayYAMLParser() { * @return the dumper */ @Override - protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @NotNull T[]> getDumper() { + protected @NotNull TriConsumer getDumper() { return (c, s, o) -> { assert o != null; listYamlParser.dump(c, s, Arrays.asList(o)); diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/CallableYAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/CallableYAMLParser.java index ec1458a..558f3b4 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/CallableYAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/CallableYAMLParser.java @@ -9,7 +9,6 @@ import it.fulminazzo.yamlparser.configuration.ConfigurationSection; import it.fulminazzo.yamlparser.utils.FileUtils; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; import java.lang.reflect.Modifier; @@ -34,7 +33,7 @@ public CallableYAMLParser(@NotNull Class tClass, FunctionException getLoader() { + protected @NotNull BiFunctionException getLoader() { return (c, s) -> { ConfigurationSection section = c.getConfigurationSection(s); if (section == null) return null; @@ -52,7 +51,7 @@ public CallableYAMLParser(@NotNull Class tClass, FunctionException getDumper() { + protected @NotNull TriConsumer getDumper() { return (c, s, t) -> { c.set(s, null); if (t == null) return; diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/CollectionYAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/CollectionYAMLParser.java index b0a4ee0..f20fadd 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/CollectionYAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/CollectionYAMLParser.java @@ -29,7 +29,7 @@ public CollectionYAMLParser(@NotNull Class aClass) { } @Override - protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable C> getLoader() { + protected @NotNull BiFunctionException getLoader() { return (c, s) -> { if (c.isConfigurationSection(s)) { @Nullable Map map = mapYamlParser.load(c, s); @@ -47,7 +47,7 @@ public CollectionYAMLParser(@NotNull Class aClass) { } @Override - protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable C> getDumper() { + protected @NotNull TriConsumer getDumper() { return (c, s, o) -> { c.set(s, null); if (o == null) return; diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/DateYAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/DateYAMLParser.java index f9f8295..8161f76 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/DateYAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/DateYAMLParser.java @@ -4,7 +4,6 @@ import it.fulminazzo.fulmicollection.interfaces.functions.BiFunctionException; import it.fulminazzo.fulmicollection.interfaces.functions.TriConsumer; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.Date; @@ -26,7 +25,7 @@ public DateYAMLParser() { * @return the loader */ @Override - protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable Date> getLoader() { + protected @NotNull BiFunctionException getLoader() { return (c, s) -> { Long l = c.getLong(s); return l == null ? null : new Date(l); @@ -39,7 +38,7 @@ public DateYAMLParser() { * @return the dumper */ @Override - protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable Date> getDumper() { + protected @NotNull TriConsumer getDumper() { return (c, s, d) -> c.set(s, d == null ? null : d.getTime()); } } diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/EnumYAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/EnumYAMLParser.java index 46bf91d..12f4069 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/EnumYAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/EnumYAMLParser.java @@ -4,7 +4,6 @@ import it.fulminazzo.fulmicollection.interfaces.functions.TriConsumer; import it.fulminazzo.yamlparser.configuration.IConfiguration; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Enum YAML parser. @@ -24,7 +23,7 @@ public EnumYAMLParser(@NotNull Class eClass) { } @Override - protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable E> getLoader() { + protected @NotNull BiFunctionException getLoader() { return (c, s) -> { String enumString = c.getString(s); return E.valueOf(getOClass(), enumString); @@ -32,7 +31,7 @@ public EnumYAMLParser(@NotNull Class eClass) { } @Override - protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable E> getDumper() { + protected @NotNull TriConsumer getDumper() { return (c, s, e) -> c.set(s, e == null ? null : e.name()); } } diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/ListYAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/ListYAMLParser.java index 04f5620..51afd0d 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/ListYAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/ListYAMLParser.java @@ -4,7 +4,6 @@ import it.fulminazzo.yamlparser.configuration.IConfiguration; import it.fulminazzo.fulmicollection.interfaces.functions.BiFunctionException; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -32,7 +31,7 @@ public ListYAMLParser() { * @return the loader */ @Override - protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable List> getLoader() { + protected @NotNull BiFunctionException> getLoader() { return (c, s) -> { Collection loaded = super.getLoader().apply(c, s); return loaded == null ? null : new ArrayList<>(loaded); @@ -40,7 +39,7 @@ public ListYAMLParser() { } @Override - protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable List> getDumper() { + protected @NotNull TriConsumer> getDumper() { return (c, s, o) -> { if (o != null && !o.isEmpty()) { Object firstNonNull = o.stream().filter(Objects::nonNull).findFirst().orElse(null); diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/MapYAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/MapYAMLParser.java index bb711d3..2599fb5 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/MapYAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/MapYAMLParser.java @@ -7,7 +7,6 @@ import it.fulminazzo.yamlparser.configuration.ConfigurationSection; import it.fulminazzo.yamlparser.configuration.IConfiguration; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.Map; @@ -51,7 +50,7 @@ public MapYAMLParser(Function keyLoader, Function keyParse * @return the loader */ @Override - protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable Map> getLoader() { + protected @NotNull BiFunctionException> getLoader() { return (c, s) -> { ConfigurationSection section = c.getConfigurationSection(s); Class oClass = null; @@ -73,7 +72,7 @@ public MapYAMLParser(Function keyLoader, Function keyParse * @return the dumper */ @Override - protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @NotNull Map> getDumper() { + protected @NotNull TriConsumer> getDumper() { return (c, s, m) -> { ConfigurationSection section = c.createSection(s); m.forEach((k, v) -> section.set(keyParser.apply(k), v)); diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/SerializableYAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/SerializableYAMLParser.java index a3873d5..e1d5b62 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/SerializableYAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/SerializableYAMLParser.java @@ -5,7 +5,6 @@ import it.fulminazzo.fulmicollection.interfaces.functions.BiFunctionException; import it.fulminazzo.fulmicollection.interfaces.functions.TriConsumer; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.io.Serializable; @@ -27,7 +26,7 @@ public SerializableYAMLParser() { * @return the loader */ @Override - protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable Serializable> getLoader() { + protected @NotNull BiFunctionException getLoader() { return (c, s) -> { try { String string = (String) c.getObject(s); @@ -44,7 +43,7 @@ public SerializableYAMLParser() { * @return the dumper */ @Override - protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @NotNull Serializable> getDumper() { + protected @NotNull TriConsumer getDumper() { return (c, s, ser) -> c.set(s, SerializeUtils.serializeToBase64(ser)); } } diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/SetYAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/SetYAMLParser.java index 63c5ba6..8430df7 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/SetYAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/SetYAMLParser.java @@ -30,7 +30,7 @@ public SetYAMLParser() { * @return the loader */ @Override - protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable Set> getLoader() { + protected @NotNull BiFunctionException> getLoader() { return (c, s) -> { @Nullable Collection object = super.getLoader().apply(c, s); return new HashSet<>(object); diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/UUIDYAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/UUIDYAMLParser.java index 2aace3b..8f7e6df 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/UUIDYAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/UUIDYAMLParser.java @@ -4,7 +4,6 @@ import it.fulminazzo.fulmicollection.interfaces.functions.BiFunctionException; import it.fulminazzo.fulmicollection.interfaces.functions.TriConsumer; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.UUID; @@ -26,7 +25,7 @@ public UUIDYAMLParser() { * @return the loader */ @Override - protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable UUID> getLoader() { + protected @NotNull BiFunctionException getLoader() { return (c, s) -> { String raw = c.getString(s); return UUID.fromString(raw); @@ -39,7 +38,7 @@ public UUIDYAMLParser() { * @return the dumper */ @Override - protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable UUID> getDumper() { + protected @NotNull TriConsumer getDumper() { return (c, s, u) -> c.set(s, u == null ? null : u.toString()); } } \ No newline at end of file diff --git a/src/main/java/it/fulminazzo/yamlparser/parsers/YAMLParser.java b/src/main/java/it/fulminazzo/yamlparser/parsers/YAMLParser.java index 325ca5d..d8e4d53 100644 --- a/src/main/java/it/fulminazzo/yamlparser/parsers/YAMLParser.java +++ b/src/main/java/it/fulminazzo/yamlparser/parsers/YAMLParser.java @@ -63,14 +63,14 @@ public void dump(@Nullable IConfiguration section, @Nullable String path, @Nulla * * @return the loader */ - protected abstract BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable O> getLoader(); + protected abstract BiFunctionException getLoader(); /** * Gets dumper. * * @return the dumper */ - protected abstract TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable O> getDumper(); + protected abstract TriConsumer getDumper(); @Override public boolean equals(Object o) {