- All Known Implementing Classes:
EventProvider,InMemoryProvider,NoOpProvider
public interface FeatureProvider
The interface implemented by upstream flag providers to resolve flags for
their service. If you want to support realtime events with your provider, you
should extend
EventProvider-
Method Summary
Modifier and TypeMethodDescriptiongetBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx) getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx) getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx) getObjectEvaluation(String key, Value defaultValue, EvaluationContext ctx) default ProviderStategetState()Deprecated.The state is handled by the SDK internally.getStringEvaluation(String key, String defaultValue, EvaluationContext ctx) default voidinitialize(EvaluationContext evaluationContext) This method is called before a provider is used to evaluate flags.default voidshutdown()This method is called when a new provider is about to be used to evaluate flags, or the SDK is shut down.default voidtrack(String eventName, EvaluationContext context, TrackingEventDetails details) Feature provider implementations can opt in for to support Tracking by implementing this method.
-
Method Details
-
getMetadata
Metadata getMetadata() -
getProviderHooks
-
getBooleanEvaluation
ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defaultValue, EvaluationContext ctx) -
getStringEvaluation
ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx) -
getIntegerEvaluation
ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx) -
getDoubleEvaluation
ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx) -
getObjectEvaluation
ProviderEvaluation<Value> getObjectEvaluation(String key, Value defaultValue, EvaluationContext ctx) -
initialize
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.It is ok if the method is expensive as it is executed in the background. All runtime exceptions will be caught and logged.
- Throws:
Exception
-
shutdown
default void shutdown()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.It is ok if the method is expensive as it is executed in the background. All runtime exceptions will be caught and logged.
-
getState
Deprecated.The state is handled by the SDK internally. Query the state from theClientinstead.Returns a representation of the current readiness of the provider. If the provider needs to be initialized, it should returnProviderState.NOT_READY. If the provider is in an error state, it should returnProviderState.ERROR. If the provider is functioning normally, it should returnProviderState.READY.Providers which do not implement this method are assumed to be ready immediately.
- Returns:
- ProviderState
-
track
Feature provider implementations can opt in for to support Tracking by implementing this method.- Parameters:
eventName- The name of the tracking eventcontext- Evaluation context used in flag evaluation (Optional)details- Data pertinent to a particular tracking event (Optional)
-