diff options
Diffstat (limited to 'src/main/java/dev/isxander/yacl3/impl/SelfContainedBinding.java')
-rw-r--r-- | src/main/java/dev/isxander/yacl3/impl/SelfContainedBinding.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/dev/isxander/yacl3/impl/SelfContainedBinding.java b/src/main/java/dev/isxander/yacl3/impl/SelfContainedBinding.java new file mode 100644 index 0000000..022cba7 --- /dev/null +++ b/src/main/java/dev/isxander/yacl3/impl/SelfContainedBinding.java @@ -0,0 +1,32 @@ +package dev.isxander.yacl3.impl; + +import dev.isxander.yacl3.api.Binding; + +public class SelfContainedBinding<T> implements Binding<T> { + private T value; + private final T defaultValue; + + public SelfContainedBinding(T value, T defaultValue) { + this.value = value; + this.defaultValue = defaultValue; + } + + public SelfContainedBinding(T value) { + this(value, value); + } + + @Override + public void setValue(T value) { + this.value = value; + } + + @Override + public T getValue() { + return this.value; + } + + @Override + public T defaultValue() { + return this.defaultValue; + } +} |