Package com.flagsmith.mappers
Class EngineMappers
java.lang.Object
com.flagsmith.mappers.EngineMappers
EngineMappers
Utility class for mapping JSON data to flag engine context objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EvaluationContextmapContextAndIdentityDataToContext(EvaluationContext context, String identifier, Map<String, Object> traits) Maps context and identity data to evaluation context.static EvaluationContextmapEnvironmentDocumentToContext(com.fasterxml.jackson.databind.JsonNode environmentDocument) Maps environment document to evaluation context.static EvaluationContextmapEnvironmentToContext(EnvironmentModel environmentModel) Maps environment model to evaluation context.static FlagmapFlagResultToFlag(FlagResult flagResult) Maps FlagResult to Flag.
-
Constructor Details
-
EngineMappers
public EngineMappers()
-
-
Method Details
-
mapFlagResultToFlag
Maps FlagResult to Flag. Returns null if metadata is missing or invalid.- Parameters:
flagResult- the flag result- Returns:
- the mapped flag or null
-
mapContextAndIdentityDataToContext
public static EvaluationContext mapContextAndIdentityDataToContext(EvaluationContext context, String identifier, Map<String, Object> traits) Maps context and identity data to evaluation context.- Parameters:
context- the base evaluation contextidentifier- the identity identifiertraits- optional traits mapping- Returns:
- the updated evaluation context with identity information
-
mapEnvironmentDocumentToContext
public static EvaluationContext mapEnvironmentDocumentToContext(com.fasterxml.jackson.databind.JsonNode environmentDocument) Maps environment document to evaluation context.- Parameters:
environmentDocument- the environment document JSON- Returns:
- the evaluation context
-
mapEnvironmentToContext
Maps environment model to evaluation context.- Parameters:
environmentModel- the environment model- Returns:
- the evaluation context
-