
com.launchdarkly.sdk.server.EvaluatorWithHooks Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of launchdarkly-java-server-sdk Show documentation
Show all versions of launchdarkly-java-server-sdk Show documentation
Official LaunchDarkly SDK for Java
package com.launchdarkly.sdk.server;
import com.launchdarkly.logging.LDLogger;
import com.launchdarkly.sdk.LDContext;
import com.launchdarkly.sdk.LDValue;
import com.launchdarkly.sdk.LDValueType;
import com.launchdarkly.sdk.server.integrations.EvaluationSeriesContext;
import com.launchdarkly.sdk.server.integrations.Hook;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* An {@link EvaluatorInterface} that will invoke the evaluation series methods of the provided {@link Hook} when
* evaluations are made.
*/
class EvaluatorWithHooks implements EvaluatorInterface {
private final EvaluatorInterface underlyingEvaluator;
private final List hooks;
private final LDLogger logger;
/**
* @param underlyingEvaluator that will do the actual flag evaluation
* @param hooks that will be invoked at various stages of the evaluation series
* @param hooksLogger that will be used to log
*/
EvaluatorWithHooks(EvaluatorInterface underlyingEvaluator, List hooks, LDLogger hooksLogger) {
this.underlyingEvaluator = underlyingEvaluator;
this.hooks = hooks;
this.logger = hooksLogger;
}
@Override
public EvalResultAndFlag evalAndFlag(String method, String featureKey, LDContext context, LDValue defaultValue, LDValueType requireType, EvaluationOptions options) {
// Each hook will have an opportunity to provide series data to carry along to later stages. This list
// is to track that data.
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy