Skip to content

Commit f554669

Browse files
committed
Settle on interface w/ default methods. Fixes open-feature#8
1 parent b57e554 commit f554669

File tree

1 file changed

+5
-6
lines changed
  • lib/src/main/java/dev/openfeature/javasdk

1 file changed

+5
-6
lines changed

lib/src/main/java/dev/openfeature/javasdk/Hook.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44

55
import java.util.Optional;
66

7-
// TODO: interface? or abstract class?
8-
public abstract class Hook<T> {
9-
public Optional<EvaluationContext> before(HookContext<T> ctx, ImmutableMap<String, Object> hints) {
7+
public interface Hook<T> {
8+
default Optional<EvaluationContext> before(HookContext<T> ctx, ImmutableMap<String, Object> hints) {
109
return Optional.empty();
1110
}
12-
public void after(HookContext<T> ctx, FlagEvaluationDetails<T> details, ImmutableMap<String, Object> hints) {}
13-
public void error(HookContext<T> ctx, Exception error, ImmutableMap<String, Object> hints) {}
14-
public void finallyAfter(HookContext<T> ctx, ImmutableMap<String, Object> hints) {}
11+
default void after(HookContext<T> ctx, FlagEvaluationDetails<T> details, ImmutableMap<String, Object> hints) {}
12+
default void error(HookContext<T> ctx, Exception error, ImmutableMap<String, Object> hints) {}
13+
default void finallyAfter(HookContext<T> ctx, ImmutableMap<String, Object> hints) {}
1514
}

0 commit comments

Comments
 (0)