@@ -39,11 +39,6 @@ public class FliptProvider extends EventProvider {
39
39
@ Setter (AccessLevel .PROTECTED )
40
40
@ Getter
41
41
private FliptClient fliptClient ;
42
-
43
- @ Setter (AccessLevel .PROTECTED )
44
- @ Getter
45
- private ProviderState state = ProviderState .NOT_READY ;
46
-
47
42
private final AtomicBoolean isInitialized = new AtomicBoolean (false );
48
43
49
44
/**
@@ -100,8 +95,8 @@ public ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defa
100
95
101
96
@ Override
102
97
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 );
105
100
return ProviderEvaluation .<String >builder ()
106
101
.value (valueProviderEvaluation .getValue ().asString ())
107
102
.variant (valueProviderEvaluation .getVariant ())
@@ -113,8 +108,8 @@ public ProviderEvaluation<String> getStringEvaluation(String key, String default
113
108
114
109
@ Override
115
110
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 );
118
113
Integer value = getIntegerValue (valueProviderEvaluation , defaultValue );
119
114
return ProviderEvaluation .<Integer >builder ()
120
115
.value (value )
@@ -136,8 +131,8 @@ private static Integer getIntegerValue(ProviderEvaluation<Value> valueProviderEv
136
131
137
132
@ Override
138
133
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 );
141
136
Double value = getDoubleValue (valueProviderEvaluation , defaultValue );
142
137
return ProviderEvaluation .<Double >builder ()
143
138
.value (value )
@@ -162,14 +157,8 @@ public ProviderEvaluation<Value> getObjectEvaluation(String key, Value defaultVa
162
157
return evaluateVariant (Value .class , key , defaultValue , ctx );
163
158
}
164
159
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 ) {
173
162
174
163
Map <String , String > contextMap = ContextTransformer .transform (ctx );
175
164
EvaluationRequest request = EvaluationRequest .builder ().namespaceKey (fliptProviderConfig .getNamespace ())
@@ -202,11 +191,11 @@ private <T> ProviderEvaluation<Value> evaluateVariant(Class<T> clazz, String key
202
191
}
203
192
204
193
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 ();
210
199
}
211
200
212
201
@ Override
0 commit comments