aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl3/impl/SelfContainedBinding.java
blob: 022cba77651ba1af966fee3abc74ecaa84121702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
    }
}