forked from open-feature/java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFeatureProvider.java
50 lines (39 loc) · 1.75 KB
/
FeatureProvider.java
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package dev.openfeature.sdk;
import java.util.ArrayList;
import java.util.List;
/**
* The interface implemented by upstream flag providers to resolve flags for their service.
*/
public interface FeatureProvider {
Metadata getMetadata();
default List<Hook> getProviderHooks() {
return new ArrayList<>();
}
ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx);
ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx);
ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx);
ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx);
ProviderEvaluation<Value> getObjectEvaluation(String key, Value defaultValue, EvaluationContext ctx);
/**
* This method is called before a provider is used to evaluate flags. Providers can overwrite this method,
* if they have special initialization needed prior being called for flag evaluation.
* <p>
* It is ok, if the method is expensive as it is executed in the background. All runtime exceptions will be
* caught and logged.
* </p>
*/
default void initialize() {
// Intentionally left blank
}
/**
* This method is called when a new provider is about to be used to evaluate flags, or the SDK is shut down.
* Providers can overwrite this method, if they have special shutdown actions needed.
* <p>
* It is ok, if the method is expensive as it is executed in the background. All runtime exceptions will be
* caught and logged.
* </p>
*/
default void shutdown() {
// Intentionally left blank
}
}