Settle on interface w/ default methods. Fixes #8
This commit is contained in:
parent
b57e55436d
commit
f5546691a3
|
|
@ -4,12 +4,11 @@ import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
// TODO: interface? or abstract class?
|
public interface Hook<T> {
|
||||||
public abstract class Hook<T> {
|
default Optional<EvaluationContext> before(HookContext<T> ctx, ImmutableMap<String, Object> hints) {
|
||||||
public Optional<EvaluationContext> before(HookContext<T> ctx, ImmutableMap<String, Object> hints) {
|
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
public void after(HookContext<T> ctx, FlagEvaluationDetails<T> details, ImmutableMap<String, Object> hints) {}
|
default void after(HookContext<T> ctx, FlagEvaluationDetails<T> details, ImmutableMap<String, Object> hints) {}
|
||||||
public void error(HookContext<T> ctx, Exception error, ImmutableMap<String, Object> hints) {}
|
default void error(HookContext<T> ctx, Exception error, ImmutableMap<String, Object> hints) {}
|
||||||
public void finallyAfter(HookContext<T> ctx, ImmutableMap<String, Object> hints) {}
|
default void finallyAfter(HookContext<T> ctx, ImmutableMap<String, Object> hints) {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue