Skip to content

Commit

Permalink
Removed unnecessary nullity notations for parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
fulminazzo committed Apr 12, 2024
1 parent ee8de2d commit f375beb
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.CallableYAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* This parser allows parsing an object using the {@link CallableYAMLParser} methods.
Expand Down Expand Up @@ -34,7 +33,7 @@ public TypedParser(final @NotNull Class<C> clazz) {

@SuppressWarnings("unchecked")
@Override
protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable C> getDumper() {
protected TriConsumer<IConfiguration, String, C> getDumper() {
return (c, s, g) -> {
super.getDumper().accept(c, s, g);
if (g == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import it.fulminazzo.fulmicollection.objects.Refl;
import it.fulminazzo.fulmicollection.utils.ReflectionUtils;
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;
Expand All @@ -24,7 +23,7 @@ public GUIParser() {
}

@Override
protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable GUI> getLoader() {
protected BiFunctionException<IConfiguration, String, GUI> getLoader() {
return (c, s) -> {
GUI g = super.getLoader().apply(c, s);
Integer size = c.getInteger(s + ".size");
Expand All @@ -40,7 +39,7 @@ public GUIParser() {
}

@Override
protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable GUI> getDumper() {
protected TriConsumer<IConfiguration, String, GUI> getDumper() {
return (c, s, g) -> {
super.getDumper().accept(c, s, g);
if (g == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.lang.reflect.Constructor;

Expand All @@ -26,12 +25,12 @@ public class SerializableFunctionParser<F extends SerializableFunction> extends
*
* @param clazz the {@link SerializableFunction} class
*/
public SerializableFunctionParser(@NotNull Class<F> clazz) {
public SerializableFunctionParser(final @NotNull Class<F> clazz) {
super(clazz);
}

@Override
protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable F> getLoader() {
protected BiFunctionException<IConfiguration, String, F> getLoader() {
return (c, s) -> {
ConfigurationSection section = c.getConfigurationSection(s);
if (section == null) return null;
Expand All @@ -52,7 +51,7 @@ public SerializableFunctionParser(@NotNull Class<F> clazz) {
}

@Override
protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable F> getDumper() {
protected TriConsumer<IConfiguration, String, F> getDumper() {
return (c, s, f) -> {
c.set(s, null);
if (f == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import it.fulminazzo.yamlparser.configuration.ConfigurationSection;
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -31,7 +29,7 @@ public ItemParser() {
}

@Override
protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable Item> getLoader() {
protected BiFunctionException<IConfiguration, String, Item> getLoader() {
return (c, s) -> {
final ConfigurationSection itemSection = c.getConfigurationSection(s);
if (itemSection == null) return null;
Expand Down Expand Up @@ -63,7 +61,7 @@ public ItemParser() {
}

@Override
protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable Item> getDumper() {
protected TriConsumer<IConfiguration, String, Item> getDumper() {
return (c, s, i) -> {
c.set(s, null);
if (i != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import it.fulminazzo.fulmicollection.interfaces.functions.TriConsumer;
import it.fulminazzo.fulmicollection.objects.Refl;
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -38,7 +36,7 @@ protected BiFunctionException<IConfiguration, String, Recipe> getLoader() {
}

@Override
protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable Recipe> getDumper() {
protected TriConsumer<IConfiguration, String, Recipe> getDumper() {
return super.getDumper().andThen((c, s, r) -> {
if (r == null) return;
if (!r.isEmpty()) c.set(s + ".ingredients.value-class", null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import it.fulminazzo.fulmicollection.interfaces.functions.TriConsumer;
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* A parser to serialize {@link Color}.
Expand All @@ -21,7 +19,7 @@ public ColorParser() {
}

@Override
protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable Color> getLoader() {
protected BiFunctionException<IConfiguration, String, Color> getLoader() {
return (c, s) -> {
String name = c.getString(s);
if (name == null) return null;
Expand All @@ -32,7 +30,7 @@ public ColorParser() {
}

@Override
protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable Color> getDumper() {
protected TriConsumer<IConfiguration, String, Color> getDumper() {
return (c, s, o) -> {
c.set(s, null);
if (o == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import it.fulminazzo.fulmicollection.interfaces.functions.TriConsumer;
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* A parser to serialize {@link BlockDataOption}.
Expand All @@ -21,7 +19,7 @@ public BlockDataOptionParser() {
}

@Override
protected BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable BlockDataOption> getLoader() {
protected BiFunctionException<IConfiguration, String, BlockDataOption> getLoader() {
return (c, s) -> {
String raw = c.getString(s);
if (raw == null) return null;
Expand All @@ -30,7 +28,7 @@ public BlockDataOptionParser() {
}

@Override
protected TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable BlockDataOption> getDumper() {
protected TriConsumer<IConfiguration, String, BlockDataOption> getDumper() {
return (c, s, b) -> {
c.set(s, null);
if (b == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import it.fulminazzo.fulmicollection.interfaces.functions.TriConsumer;
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* A parser to serialize {@link ColorParticleOption}.
Expand All @@ -22,7 +20,7 @@ public ColorOptionParser() {
}

@Override
protected BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable ColorParticleOption> getLoader() {
protected BiFunctionException<IConfiguration, String, ColorParticleOption> getLoader() {
return (c, s) -> {
Color color = c.get(s, Color.class);
if (color == null) return null;
Expand All @@ -31,7 +29,7 @@ public ColorOptionParser() {
}

@Override
protected TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable ColorParticleOption> getDumper() {
protected TriConsumer<IConfiguration, String, ColorParticleOption> getDumper() {
return (c, s, p) -> c.set(s, p == null ? null : p.getOption());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import it.fulminazzo.fulmicollection.utils.ReflectionUtils;
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* A parser to serialize {@link ItemParticleOption}.
Expand All @@ -22,7 +20,7 @@ public ItemParticleOptionParser() {
}

@Override
protected BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable ItemParticleOption<?>> getLoader() {
protected BiFunctionException<IConfiguration, String, ItemParticleOption<?>> getLoader() {
return (c, s) -> {
AbstractItem item = c.get(s, ReflectionUtils.getClass("it.angrybear.yagl.items.Item"));
if (item == null) return null;
Expand All @@ -31,7 +29,7 @@ public ItemParticleOptionParser() {
}

@Override
protected TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable ItemParticleOption<?>> getDumper() {
protected TriConsumer<IConfiguration, String, ItemParticleOption<?>> getDumper() {
return (c, s, o) -> c.set(s, o == null ? null : o.getOption());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import it.fulminazzo.fulmicollection.structures.Tuple;
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* A parser to serialize {@link MaterialDataOption}.
Expand All @@ -22,7 +20,7 @@ public MaterialDataOptionParser() {
}

@Override
protected BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable MaterialDataOption> getLoader() {
protected BiFunctionException<IConfiguration, String, MaterialDataOption> getLoader() {
return (c, s) -> {
String raw = c.getString(s);
if (raw == null) return null;
Expand All @@ -31,7 +29,7 @@ public MaterialDataOptionParser() {
}

@Override
protected TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable MaterialDataOption> getDumper() {
protected TriConsumer<IConfiguration, String, MaterialDataOption> getDumper() {
return (c, s, b) -> {
c.set(s, null);
if (b == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import it.fulminazzo.yamlparser.parsers.annotations.PreventSaving;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
Expand All @@ -35,7 +34,7 @@ public ParticleOptionParser(@NotNull Class<P> pClass) {
}

@Override
protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable P> getLoader() {
protected BiFunctionException<IConfiguration, String, P> getLoader() {
return (c, s) -> {
Refl<?> reflP = new Refl<>(getOClass(), new Object[0]);

Expand All @@ -62,7 +61,7 @@ private void loadField(@NotNull Refl<?> reflP, @NotNull IConfiguration section,
}

@Override
protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable P> getDumper() {
protected TriConsumer<IConfiguration, String, P> getDumper() {
return (c, s, p) -> {
c.set(s, null);
if (p == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import it.fulminazzo.yamlparser.configuration.ConfigurationSection;
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* A parser to serialize {@link Particle}.
Expand All @@ -23,7 +21,7 @@ public ParticleParser() {
}

@Override
protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable Particle> getLoader() {
protected BiFunctionException<IConfiguration, String, Particle> getLoader() {
return (c, s) -> {
ConfigurationSection particleSection = c.getConfigurationSection(s);
if (particleSection == null) return null;
Expand All @@ -48,7 +46,7 @@ public ParticleParser() {
}

@Override
protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable Particle> getDumper() {
protected TriConsumer<IConfiguration, String, Particle> getDumper() {
return (c, s, p) -> {
c.set(s, null);
if (p == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import it.fulminazzo.fulmicollection.interfaces.functions.TriConsumer;
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* A parser to serialize {@link PotionParticleOption}.
Expand All @@ -22,7 +20,7 @@ public PotionParticleOptionParser() {
}

@Override
protected BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable PotionParticleOption> getLoader() {
protected BiFunctionException<IConfiguration, String, PotionParticleOption> getLoader() {
return (c, s) -> {
Potion potion = c.get(s, Potion.class);
if (potion == null) return null;
Expand All @@ -31,7 +29,7 @@ public PotionParticleOptionParser() {
}

@Override
protected TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable PotionParticleOption> getDumper() {
protected TriConsumer<IConfiguration, String, PotionParticleOption> getDumper() {
return (c, s, p) -> c.set(s, p == null ? null : p.getOption());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import it.fulminazzo.yamlparser.configuration.IConfiguration;
import it.fulminazzo.yamlparser.parsers.YAMLParser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
Expand All @@ -35,7 +34,7 @@ public WrapperParser(@NotNull Class<W> clazz) {
}

@Override
protected @NotNull BiFunctionException<@NotNull IConfiguration, @NotNull String, @Nullable W> getLoader() {
protected BiFunctionException<IConfiguration, String, W> getLoader() {
return (c, s) -> {
String raw = c.getString(s);
if (raw == null || raw.trim().isEmpty()) return null;
Expand Down Expand Up @@ -80,7 +79,7 @@ public WrapperParser(@NotNull Class<W> clazz) {
}

@Override
protected @NotNull TriConsumer<@NotNull IConfiguration, @NotNull String, @Nullable W> getDumper() {
protected TriConsumer<IConfiguration, String, W> getDumper() {
return (c, s, w) -> {
c.set(s, null);
if (w == null) return;
Expand Down

0 comments on commit f375beb

Please sign in to comment.