aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/api/Binding.java
blob: 74120a0698b2551a652cf2c4a02e7e37403065a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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();

    T defaultValue();

    static <T> Binding<T> of(T def, Supplier<T> getter, Consumer<T> setter) {
        return new GenericBindingImpl<>(def, getter, setter);
    }
}