Class IdentityContext
Represents an identity context for feature flag evaluation.
-
Constructor Summary
ConstructorsConstructorDescriptionNo args constructor for use in serialization.IdentityContext(IdentityContext source) Copy constructor.IdentityContext(String identifier, String key) Constructor with required fields.IdentityContext(String identifier, String key, Traits traits) Constructor with all fields. -
Method Summary
Modifier and TypeMethodDescriptionIdentifiergetKey()KeyTraitsvoidsetAdditionalProperty(String name, Object value) Set additional property.voidsetIdentifier(String identifier) IdentifiervoidKeyvoidTraitstoString()withAdditionalProperty(String name, Object value) Fluent setter for additional properties.withIdentifier(String identifier) Fluent setter for identifier.Fluent setter for key.withTraits(Traits traits) Fluent setter for traits.
-
Constructor Details
-
IdentityContext
public IdentityContext()No args constructor for use in serialization. -
IdentityContext
Copy constructor.- Parameters:
source- the object being copied
-
IdentityContext
Constructor with required fields.- Parameters:
identifier- A unique identifier for an identitykey- Key used when selecting a value for a multivariate feature
-
IdentityContext
Constructor with all fields.- Parameters:
identifier- A unique identifier for an identitykey- Key used when selecting a value for a multivariate featuretraits- A map of traits associated with the identity
-
-
Method Details
-
getIdentifier
IdentifierA unique identifier for an identity, used for segment and multivariate feature flag targeting, and displayed in the Flagsmith UI. (Required)
-
setIdentifier
IdentifierA unique identifier for an identity, used for segment and multivariate feature flag targeting, and displayed in the Flagsmith UI. (Required)
-
withIdentifier
Fluent setter for identifier.- Parameters:
identifier- A unique identifier for an identity- Returns:
- the IdentityContext instance
-
getKey
KeyKey used when selecting a value for a multivariate feature, or for % split segmentation. Set to an internal identifier or a composite value based on the environment key and identifier, depending on Flagsmith implementation. (Required)
-
setKey
KeyKey used when selecting a value for a multivariate feature, or for % split segmentation. Set to an internal identifier or a composite value based on the environment key and identifier, depending on Flagsmith implementation. (Required)
-
withKey
Fluent setter for key.- Parameters:
key- the key- Returns:
- the IdentityContext instance
-
getTraits
TraitsA map of traits associated with the identity, where the key is the trait name and the value is the trait value.
-
setTraits
TraitsA map of traits associated with the identity, where the key is the trait name and the value is the trait value.
-
withTraits
Fluent setter for traits.- Parameters:
traits- A map of traits associated with the identity- Returns:
- the IdentityContext instance
-
getAdditionalProperties
-
setAdditionalProperty
Set additional property.- Parameters:
name- the namevalue- the value
-
withAdditionalProperty
Fluent setter for additional properties.- Parameters:
name- the name of the additional propertyvalue- the value of the additional property- Returns:
- the IdentityContext instance
-
toString
-