diff --git a/common/src/main/java/net/kunmc/lab/configlib/CollectionValue.java b/common/src/main/java/net/kunmc/lab/configlib/CollectionValue.java index cc66ecf..b4981f2 100644 --- a/common/src/main/java/net/kunmc/lab/configlib/CollectionValue.java +++ b/common/src/main/java/net/kunmc/lab/configlib/CollectionValue.java @@ -22,11 +22,11 @@ public CollectionValue(T value) { super(value); } - protected boolean addableByCommand() { + protected final boolean addableByCommand() { return addable; } - public U addableByCommand(boolean addable) { + public final U addableByCommand(boolean addable) { this.addable = addable; return ((U) this); } @@ -58,11 +58,11 @@ protected String succeedMessageForAdd(String entryName, T value) { return String.format("%sに%sを追加しました.", entryName, elementToString(((E[]) value.toArray())[0])); } - protected boolean removableByCommand() { + protected final boolean removableByCommand() { return removable; } - public U removableByCommand(boolean removable) { + public final U removableByCommand(boolean removable) { this.removable = removable; return ((U) this); } @@ -94,11 +94,11 @@ protected String succeedMessageForRemove(String entryName, T value) { return String.format("%sから%sを削除しました.", entryName, elementToString(((E[]) value.toArray())[0])); } - protected boolean clearableByCommand() { + protected final boolean clearableByCommand() { return clearable; } - public U clearableByCommand(boolean clearable) { + public final U clearableByCommand(boolean clearable) { this.clearable = clearable; return ((U) this); } diff --git a/common/src/main/java/net/kunmc/lab/configlib/MapValue.java b/common/src/main/java/net/kunmc/lab/configlib/MapValue.java index cb684bb..764220e 100644 --- a/common/src/main/java/net/kunmc/lab/configlib/MapValue.java +++ b/common/src/main/java/net/kunmc/lab/configlib/MapValue.java @@ -23,11 +23,11 @@ public MapValue(Map value) { super(value); } - protected boolean puttableByCommand() { + protected final boolean puttableByCommand() { return puttable; } - public T puttableByCommand(boolean puttable) { + public final T puttableByCommand(boolean puttable) { this.puttable = puttable; return ((T) this); } @@ -83,11 +83,11 @@ protected String succeedMessageForPut(String entryName, K k, V v) { return String.format("%sに{%s:%s}を追加しました.", entryName, keyToString(k), valueToString(v)); } - protected boolean removableByCommand() { + protected final boolean removableByCommand() { return removable; } - public T removableByCommand(boolean removable) { + public final T removableByCommand(boolean removable) { this.removable = removable; return ((T) this); } @@ -125,7 +125,7 @@ protected String succeedMessageForRemove(String entryName, K k, V v) { return String.format("%sから{%s:%s}を削除しました.", entryName, keyToString(k), valueToString(v)); } - protected boolean clearableByCommand() { + protected final boolean clearableByCommand() { return clearable; } @@ -139,7 +139,7 @@ public final T onClear(Runnable listener) { return ((T) this); } - protected void onClearMap() { + protected final void onClearMap() { clearListeners.forEach(Runnable::run); } diff --git a/common/src/main/java/net/kunmc/lab/configlib/Value.java b/common/src/main/java/net/kunmc/lab/configlib/Value.java index f4dd397..c8c54ce 100644 --- a/common/src/main/java/net/kunmc/lab/configlib/Value.java +++ b/common/src/main/java/net/kunmc/lab/configlib/Value.java @@ -21,20 +21,20 @@ public void value(E value) { this.value = value; } - public String description() { + public final String description() { return description; } - public T description(String description) { + public final T description(String description) { this.description = description; return ((T) this); } - protected boolean listable() { + protected final boolean listable() { return listable; } - public T listable(boolean listable) { + public final T listable(boolean listable) { this.listable = listable; return ((T) this); } diff --git a/common/src/main/java/net/kunmc/lab/configlib/value/collection/ListValue.java b/common/src/main/java/net/kunmc/lab/configlib/value/collection/ListValue.java index f06db42..6e536da 100644 --- a/common/src/main/java/net/kunmc/lab/configlib/value/collection/ListValue.java +++ b/common/src/main/java/net/kunmc/lab/configlib/value/collection/ListValue.java @@ -9,25 +9,10 @@ import java.util.stream.Stream; public abstract class ListValue> extends CollectionValue, E, U> implements Iterable { - protected transient boolean listable = true; - protected transient boolean addable = true; - protected transient boolean removable = true; - protected transient boolean clearable = true; - public ListValue(List value) { super(value); } - @Override - public boolean addableByCommand() { - return addable; - } - - public U addableByCommand(boolean addable) { - this.addable = addable; - return (U) this; - } - @Override protected boolean validateForAdd(String entryName, List value, CommandContext ctx) { return true; @@ -38,16 +23,6 @@ protected String invalidValueMessageForAdd(String entryName, List value, Comm return "This message can't be shown."; } - @Override - public boolean removableByCommand() { - return removable; - } - - public U removableByCommand(boolean removable) { - this.removable = removable; - return (U) this; - } - @Override public boolean validateForRemove(String entryName, List element, CommandContext ctx) { return value.containsAll(element); @@ -62,26 +37,6 @@ protected final String invalidValueMessageForRemove(String entryName, List va entryName); } - @Override - public boolean clearableByCommand() { - return clearable; - } - - public U clearableByCommand(boolean clearable) { - this.clearable = clearable; - return (U) this; - } - - @Override - public boolean listable() { - return listable; - } - - public U listable(boolean listable) { - this.listable = listable; - return (U) this; - } - public int size() { return value.size(); }