aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java/dev/isxander/yacl3/api
diff options
context:
space:
mode:
authorCrendgrim <Crendgrim@users.noreply.github.com>2023-07-21 23:57:05 +0200
committerGitHub <noreply@github.com>2023-07-21 22:57:05 +0100
commit8a4d6df67917fee4b600cfad1afb7d39a75d75f1 (patch)
treec89cad79d18a5a86e5709e42b8d6129b43f54d7f /common/src/main/java/dev/isxander/yacl3/api
parenta25e2d754ae856c0c9d2c8ebb9ea16a7a458cf04 (diff)
downloadYetAnotherConfigLib-8a4d6df67917fee4b600cfad1afb7d39a75d75f1.tar.gz
YetAnotherConfigLib-8a4d6df67917fee4b600cfad1afb7d39a75d75f1.tar.bz2
YetAnotherConfigLib-8a4d6df67917fee4b600cfad1afb7d39a75d75f1.zip
Small improvements to ListOption (#89)
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl3/api')
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/ListOption.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/api/ListOption.java b/common/src/main/java/dev/isxander/yacl3/api/ListOption.java
index 8094ee7..0371c35 100644
--- a/common/src/main/java/dev/isxander/yacl3/api/ListOption.java
+++ b/common/src/main/java/dev/isxander/yacl3/api/ListOption.java
@@ -30,7 +30,16 @@ public interface ListOption<T> extends OptionGroup, Option<List<T>> {
@NotNull ImmutableList<ListOptionEntry<T>> options();
@ApiStatus.Internal
- ListOptionEntry<T> insertNewEntryToTop();
+ int numberOfEntries();
+
+ @ApiStatus.Internal
+ int maximumNumberOfEntries();
+
+ @ApiStatus.Internal
+ int minimumNumberOfEntries();
+
+ @ApiStatus.Internal
+ ListOptionEntry<T> insertNewEntry();
@ApiStatus.Internal
void insertEntry(int index, ListOptionEntry<?> entry);
@@ -106,6 +115,24 @@ public interface ListOption<T> extends OptionGroup, Option<List<T>> {
Builder<T> available(boolean available);
/**
+ * Sets a minimum size for the list. Once this size is reached,
+ * no further entries may be removed.
+ */
+ Builder<T> minimumNumberOfEntries(int number);
+
+ /**
+ * Sets a maximum size for the list. Once this size is reached,
+ * no further entries may be added.
+ */
+ Builder<T> maximumNumberOfEntries(int number);
+
+ /**
+ * Dictates if new entries should be added to the end of the list
+ * rather than the top.
+ */
+ Builder<T> insertEntriesAtEnd(boolean insertAtEnd);
+
+ /**
* Adds a flag to the option.
* Upon applying changes, all flags are executed.
* {@link Option#flags()}