Skip to content

Commit

Permalink
fix: class no found
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <[email protected]>
  • Loading branch information
toddbaert committed Oct 2, 2024
1 parent e221402 commit b14aa57
Showing 1 changed file with 13 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down Expand Up @@ -100,8 +95,8 @@ public ProviderEvaluation<Boolean> getBooleanEvaluation(String key, Boolean defa

@Override
public ProviderEvaluation<String> getStringEvaluation(String key, String defaultValue, EvaluationContext ctx) {
ProviderEvaluation<Value> valueProviderEvaluation =
evaluateVariant(String.class, key, new Value(defaultValue), ctx);
ProviderEvaluation<Value> valueProviderEvaluation = evaluateVariant(String.class, key, new Value(defaultValue),
ctx);
return ProviderEvaluation.<String>builder()
.value(valueProviderEvaluation.getValue().asString())
.variant(valueProviderEvaluation.getVariant())
Expand All @@ -113,8 +108,8 @@ public ProviderEvaluation<String> getStringEvaluation(String key, String default

@Override
public ProviderEvaluation<Integer> getIntegerEvaluation(String key, Integer defaultValue, EvaluationContext ctx) {
ProviderEvaluation<Value> valueProviderEvaluation =
evaluateVariant(Integer.class, key, new Value(defaultValue), ctx);
ProviderEvaluation<Value> valueProviderEvaluation = evaluateVariant(Integer.class, key, new Value(defaultValue),
ctx);
Integer value = getIntegerValue(valueProviderEvaluation, defaultValue);
return ProviderEvaluation.<Integer>builder()
.value(value)
Expand All @@ -136,8 +131,8 @@ private static Integer getIntegerValue(ProviderEvaluation<Value> valueProviderEv

@Override
public ProviderEvaluation<Double> getDoubleEvaluation(String key, Double defaultValue, EvaluationContext ctx) {
ProviderEvaluation<Value> valueProviderEvaluation =
evaluateVariant(Double.class, key, new Value(defaultValue), ctx);
ProviderEvaluation<Value> valueProviderEvaluation = evaluateVariant(Double.class, key, new Value(defaultValue),
ctx);
Double value = getDoubleValue(valueProviderEvaluation, defaultValue);
return ProviderEvaluation.<Double>builder()
.value(value)
Expand All @@ -162,14 +157,8 @@ public ProviderEvaluation<Value> getObjectEvaluation(String key, Value defaultVa
return evaluateVariant(Value.class, key, defaultValue, ctx);
}

private <T> ProviderEvaluation<Value> evaluateVariant(Class<T> 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 <T> ProviderEvaluation<Value> evaluateVariant(Class<T> clazz, String key, Value defaultValue,
EvaluationContext ctx) {

Map<String, String> contextMap = ContextTransformer.transform(ctx);
EvaluationRequest request = EvaluationRequest.builder().namespaceKey(fliptProviderConfig.getNamespace())
Expand Down Expand Up @@ -202,11 +191,11 @@ private <T> ProviderEvaluation<Value> evaluateVariant(Class<T> clazz, String key
}

return ProviderEvaluation.<Value>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
Expand Down

0 comments on commit b14aa57

Please sign in to comment.