aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/api/Binding.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/dev/isxander/yacl/api/Binding.java')
-rw-r--r--src/main/java/dev/isxander/yacl/api/Binding.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/dev/isxander/yacl/api/Binding.java b/src/main/java/dev/isxander/yacl/api/Binding.java
new file mode 100644
index 0000000..67ff822
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl/api/Binding.java
@@ -0,0 +1,18 @@
+package dev.isxander.yacl.api;
+
+import dev.isxander.yacl.impl.GenericBindingImpl;
+
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+public interface Binding<T> {
+ void setValue(T value);
+
+ T getValue();
+
+ void resetValue();
+
+ static <T> Binding<T> of(T def, Supplier<T> getter, Consumer<T> setter) {
+ return new GenericBindingImpl<>(def, getter, setter);
+ }
+}