@@ -39,11 +39,6 @@ public class FliptProvider extends EventProvider {
3939 @ Setter (AccessLevel .PROTECTED )
4040 @ Getter
4141 private FliptClient fliptClient ;
42-
43- @ Setter (AccessLevel .PROTECTED )
44- @ Getter
45- private ProviderState state = ProviderState .NOT_READY ;
46-
4742 private final AtomicBoolean isInitialized = new AtomicBoolean (false );
4843
4944 /**
@@ -100,8 +95,8 @@ public ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defa
10095
10196 @ Override
10297 public ProviderEvaluation <String > getStringEvaluation (String key , String defaultValue , EvaluationContext ctx ) {
103- ProviderEvaluation <Value > valueProviderEvaluation =
104- evaluateVariant ( String . class , key , new Value ( defaultValue ), ctx );
98+ ProviderEvaluation <Value > valueProviderEvaluation = evaluateVariant ( String . class , key , new Value ( defaultValue ),
99+ ctx );
105100 return ProviderEvaluation .<String >builder ()
106101 .value (valueProviderEvaluation .getValue ().asString ())
107102 .variant (valueProviderEvaluation .getVariant ())
@@ -113,8 +108,8 @@ public ProviderEvaluation<String> getStringEvaluation(String key, String default
113108
114109 @ Override
115110 public ProviderEvaluation <Integer > getIntegerEvaluation (String key , Integer defaultValue , EvaluationContext ctx ) {
116- ProviderEvaluation <Value > valueProviderEvaluation =
117- evaluateVariant ( Integer . class , key , new Value ( defaultValue ), ctx );
111+ ProviderEvaluation <Value > valueProviderEvaluation = evaluateVariant ( Integer . class , key , new Value ( defaultValue ),
112+ ctx );
118113 Integer value = getIntegerValue (valueProviderEvaluation , defaultValue );
119114 return ProviderEvaluation .<Integer >builder ()
120115 .value (value )
@@ -136,8 +131,8 @@ private static Integer getIntegerValue(ProviderEvaluation<Value> valueProviderEv
136131
137132 @ Override
138133 public ProviderEvaluation <Double > getDoubleEvaluation (String key , Double defaultValue , EvaluationContext ctx ) {
139- ProviderEvaluation <Value > valueProviderEvaluation =
140- evaluateVariant ( Double . class , key , new Value ( defaultValue ), ctx );
134+ ProviderEvaluation <Value > valueProviderEvaluation = evaluateVariant ( Double . class , key , new Value ( defaultValue ),
135+ ctx );
141136 Double value = getDoubleValue (valueProviderEvaluation , defaultValue );
142137 return ProviderEvaluation .<Double >builder ()
143138 .value (value )
@@ -162,14 +157,8 @@ public ProviderEvaluation<Value> getObjectEvaluation(String key, Value defaultVa
162157 return evaluateVariant (Value .class , key , defaultValue , ctx );
163158 }
164159
165- private <T > ProviderEvaluation <Value > evaluateVariant (Class <T > clazz , String key , Value defaultValue ,
166- EvaluationContext ctx ) {
167- if (!ProviderState .READY .equals (state )) {
168- if (ProviderState .NOT_READY .equals (state )) {
169- throw new ProviderNotReadyError (PROVIDER_NOT_YET_INITIALIZED );
170- }
171- throw new GeneralError (UNKNOWN_ERROR );
172- }
160+ private <T > ProviderEvaluation <Value > evaluateVariant (Class <T > clazz , String key , Value defaultValue ,
161+ EvaluationContext ctx ) {
173162
174163 Map <String , String > contextMap = ContextTransformer .transform (ctx );
175164 EvaluationRequest request = EvaluationRequest .builder ().namespaceKey (fliptProviderConfig .getNamespace ())
@@ -202,11 +191,11 @@ private <T> ProviderEvaluation<Value> evaluateVariant(Class<T> clazz, String key
202191 }
203192
204193 return ProviderEvaluation .<Value >builder ()
205- .value (value )
206- .variant (response .getVariantKey ())
207- .reason (TARGETING_MATCH .name ())
208- .flagMetadata (flagMetadataBuilder .build ())
209- .build ();
194+ .value (value )
195+ .variant (response .getVariantKey ())
196+ .reason (TARGETING_MATCH .name ())
197+ .flagMetadata (flagMetadataBuilder .build ())
198+ .build ();
210199 }
211200
212201 @ Override
0 commit comments