Package com.flagsmith.models
Class Flags
- java.lang.Object
-
- com.flagsmith.models.Flags
-
public class Flags extends Object
-
-
Constructor Summary
Constructors Constructor Description Flags()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FlagsfromApiFlags(com.fasterxml.jackson.databind.JsonNode apiFlags, AnalyticsProcessor analyticsProcessor, FlagsmithFlagDefaults defaultFlagHandler)Return the flags instance.static FlagsfromApiFlags(List<FeatureStateModel> apiFlags, AnalyticsProcessor analyticsProcessor, FlagsmithFlagDefaults defaultFlagHandler)Return the flags instance.static FlagsfromFeatureStateModels(List<FeatureStateModel> featureStates, AnalyticsProcessor analyticsProcessor)Build flags object from list of feature states.static FlagsfromFeatureStateModels(List<FeatureStateModel> featureStates, AnalyticsProcessor analyticsProcessor, Object identityId)Build flags object from list of feature states.static FlagsfromFeatureStateModels(List<FeatureStateModel> featureStates, AnalyticsProcessor analyticsProcessor, Object identityId, DefaultFlagHandler defaultFlagHandler)Build flags object from list of feature states.List<BaseFlag>getAllFlags()returns the list of all flags.ObjectgetFeatureValue(String featureName)Get the feature value, null if not present.BaseFlaggetFlag(String featureName)Get the feature, null if not present.booleanisFeatureEnabled(String featureName)is feature enabled, null if not present.
-
-
-
Method Detail
-
fromFeatureStateModels
public static Flags fromFeatureStateModels(List<FeatureStateModel> featureStates, AnalyticsProcessor analyticsProcessor)
Build flags object from list of feature states.- Parameters:
featureStates- list of feature statesanalyticsProcessor- instance of analytics processor- Returns:
-
fromFeatureStateModels
public static Flags fromFeatureStateModels(List<FeatureStateModel> featureStates, AnalyticsProcessor analyticsProcessor, Object identityId)
Build flags object from list of feature states.- Parameters:
featureStates- list of feature statesanalyticsProcessor- instance of analytics processoridentityId- identity ID (optional)- Returns:
-
fromFeatureStateModels
public static Flags fromFeatureStateModels(List<FeatureStateModel> featureStates, AnalyticsProcessor analyticsProcessor, Object identityId, DefaultFlagHandler defaultFlagHandler)
Build flags object from list of feature states.- Parameters:
featureStates- list of feature statesanalyticsProcessor- instance of analytics processoridentityId- identity ID (optional)defaultFlagHandler- default flags (optional)- Returns:
-
fromApiFlags
public static Flags fromApiFlags(com.fasterxml.jackson.databind.JsonNode apiFlags, AnalyticsProcessor analyticsProcessor, FlagsmithFlagDefaults defaultFlagHandler)
Return the flags instance.- Parameters:
apiFlags- Dictionary with api flagsanalyticsProcessor- instance of analytics processordefaultFlagHandler- handler for default flags if present- Returns:
-
fromApiFlags
public static Flags fromApiFlags(List<FeatureStateModel> apiFlags, AnalyticsProcessor analyticsProcessor, FlagsmithFlagDefaults defaultFlagHandler)
Return the flags instance.- Parameters:
apiFlags- Dictionary with api flagsanalyticsProcessor- instance of analytics processordefaultFlagHandler- handler for default flags if present- Returns:
-
isFeatureEnabled
public boolean isFeatureEnabled(String featureName) throws FlagsmithClientError
is feature enabled, null if not present.- Parameters:
featureName- Feature name- Returns:
- Throws:
FlagsmithClientError
-
getFeatureValue
public Object getFeatureValue(String featureName) throws FlagsmithClientError
Get the feature value, null if not present.- Parameters:
featureName- Feature name- Returns:
- Throws:
FlagsmithClientError
-
getFlag
public BaseFlag getFlag(String featureName) throws FlagsmithClientError
Get the feature, null if not present.- Parameters:
featureName- feature name- Returns:
- Throws:
FlagsmithClientError
-
-