aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/dev/isxander/yacl/api')
-rw-r--r--src/main/java/dev/isxander/yacl/api/Option.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/dev/isxander/yacl/api/Option.java b/src/main/java/dev/isxander/yacl/api/Option.java
index 65eae23..9d6ebe2 100644
--- a/src/main/java/dev/isxander/yacl/api/Option.java
+++ b/src/main/java/dev/isxander/yacl/api/Option.java
@@ -40,6 +40,12 @@ public interface Option<T> {
@NotNull Binding<T> binding();
/**
+ * Class of the option type.
+ * Used by some controllers.
+ */
+ @NotNull Class<T> typeClass();
+
+ /**
* Checks if the pending value is not equal to the current set value
*/
boolean changed();
@@ -77,7 +83,7 @@ public interface Option<T> {
* @param typeClass used to capture the type
*/
static <T> Builder<T> createBuilder(Class<T> typeClass) {
- return new Builder<>();
+ return new Builder<>(typeClass);
}
class Builder<T> {
@@ -89,8 +95,10 @@ public interface Option<T> {
private Binding<T> binding;
- private Builder() {
+ private final Class<T> typeClass;
+ private Builder(Class<T> typeClass) {
+ this.typeClass = typeClass;
}
/**
@@ -177,7 +185,7 @@ public interface Option<T> {
concatenatedTooltip.append(line);
}
- return new OptionImpl<>(name, concatenatedTooltip, controlGetter, binding);
+ return new OptionImpl<>(name, concatenatedTooltip, controlGetter, binding, typeClass);
}
}
}