From b14aa573b37ecdf2253bb22862368fc10d37e4fa Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Wed, 2 Oct 2024 09:49:47 -0400 Subject: [PATCH] fix: class no found Signed-off-by: Todd Baert --- .../providers/flipt/FliptProvider.java | 37 +++++++------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/providers/flipt/src/main/java/dev/openfeature/contrib/providers/flipt/FliptProvider.java b/providers/flipt/src/main/java/dev/openfeature/contrib/providers/flipt/FliptProvider.java index 98ff216ad..f3cc354ca 100644 --- a/providers/flipt/src/main/java/dev/openfeature/contrib/providers/flipt/FliptProvider.java +++ b/providers/flipt/src/main/java/dev/openfeature/contrib/providers/flipt/FliptProvider.java @@ -39,11 +39,6 @@ public class FliptProvider extends EventProvider { @Setter(AccessLevel.PROTECTED) @Getter private FliptClient fliptClient; - - @Setter(AccessLevel.PROTECTED) - @Getter - private ProviderState state = ProviderState.NOT_READY; - private final AtomicBoolean isInitialized = new AtomicBoolean(false); /** @@ -100,8 +95,8 @@ public ProviderEvaluation getBooleanEvaluation(String key, Boolean defa @Override public ProviderEvaluation getStringEvaluation(String key, String defaultValue, EvaluationContext ctx) { - ProviderEvaluation valueProviderEvaluation = - evaluateVariant(String.class, key, new Value(defaultValue), ctx); + ProviderEvaluation valueProviderEvaluation = evaluateVariant(String.class, key, new Value(defaultValue), + ctx); return ProviderEvaluation.builder() .value(valueProviderEvaluation.getValue().asString()) .variant(valueProviderEvaluation.getVariant()) @@ -113,8 +108,8 @@ public ProviderEvaluation getStringEvaluation(String key, String default @Override public ProviderEvaluation getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx) { - ProviderEvaluation valueProviderEvaluation = - evaluateVariant(Integer.class, key, new Value(defaultValue), ctx); + ProviderEvaluation valueProviderEvaluation = evaluateVariant(Integer.class, key, new Value(defaultValue), + ctx); Integer value = getIntegerValue(valueProviderEvaluation, defaultValue); return ProviderEvaluation.builder() .value(value) @@ -136,8 +131,8 @@ private static Integer getIntegerValue(ProviderEvaluation valueProviderEv @Override public ProviderEvaluation getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx) { - ProviderEvaluation valueProviderEvaluation = - evaluateVariant(Double.class, key, new Value(defaultValue), ctx); + ProviderEvaluation valueProviderEvaluation = evaluateVariant(Double.class, key, new Value(defaultValue), + ctx); Double value = getDoubleValue(valueProviderEvaluation, defaultValue); return ProviderEvaluation.builder() .value(value) @@ -162,14 +157,8 @@ public ProviderEvaluation getObjectEvaluation(String key, Value defaultVa return evaluateVariant(Value.class, key, defaultValue, ctx); } - private ProviderEvaluation evaluateVariant(Class clazz, String key, Value defaultValue, - EvaluationContext ctx) { - if (!ProviderState.READY.equals(state)) { - if (ProviderState.NOT_READY.equals(state)) { - throw new ProviderNotReadyError(PROVIDER_NOT_YET_INITIALIZED); - } - throw new GeneralError(UNKNOWN_ERROR); - } + private ProviderEvaluation evaluateVariant(Class clazz, String key, Value defaultValue, + EvaluationContext ctx) { Map contextMap = ContextTransformer.transform(ctx); EvaluationRequest request = EvaluationRequest.builder().namespaceKey(fliptProviderConfig.getNamespace()) @@ -202,11 +191,11 @@ private ProviderEvaluation evaluateVariant(Class clazz, String key } return ProviderEvaluation.builder() - .value(value) - .variant(response.getVariantKey()) - .reason(TARGETING_MATCH.name()) - .flagMetadata(flagMetadataBuilder.build()) - .build(); + .value(value) + .variant(response.getVariantKey()) + .reason(TARGETING_MATCH.name()) + .flagMetadata(flagMetadataBuilder.build()) + .build(); } @Override