Class IdentityContext

java.lang.Object
com.flagsmith.flagengine.IdentityContext

public class IdentityContext extends Object
IdentityContext

Represents an identity context for feature flag evaluation.

  • Constructor Details

    • IdentityContext

      public IdentityContext()
      No args constructor for use in serialization.
    • IdentityContext

      public IdentityContext(IdentityContext source)
      Copy constructor.
      Parameters:
      source - the object being copied
    • IdentityContext

      public IdentityContext(String identifier, String key)
      Constructor with required fields.
      Parameters:
      identifier - A unique identifier for an identity
      key - Key used when selecting a value for a multivariate feature
    • IdentityContext

      public IdentityContext(String identifier, String key, Traits traits)
      Constructor with all fields.
      Parameters:
      identifier - A unique identifier for an identity
      key - Key used when selecting a value for a multivariate feature
      traits - A map of traits associated with the identity
  • Method Details

    • getIdentifier

      public String getIdentifier()
      Identifier

      A unique identifier for an identity, used for segment and multivariate feature flag targeting, and displayed in the Flagsmith UI. (Required)

    • setIdentifier

      public void setIdentifier(String identifier)
      Identifier

      A unique identifier for an identity, used for segment and multivariate feature flag targeting, and displayed in the Flagsmith UI. (Required)

    • withIdentifier

      public IdentityContext withIdentifier(String identifier)
      Fluent setter for identifier.
      Parameters:
      identifier - A unique identifier for an identity
      Returns:
      the IdentityContext instance
    • getKey

      public String getKey()
      Key

      Key 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

      public void setKey(String key)
      Key

      Key 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

      public IdentityContext withKey(String key)
      Fluent setter for key.
      Parameters:
      key - the key
      Returns:
      the IdentityContext instance
    • getTraits

      public Traits getTraits()
      Traits

      A map of traits associated with the identity, where the key is the trait name and the value is the trait value.

    • setTraits

      public void setTraits(Traits traits)
      Traits

      A map of traits associated with the identity, where the key is the trait name and the value is the trait value.

    • withTraits

      public IdentityContext withTraits(Traits traits)
      Fluent setter for traits.
      Parameters:
      traits - A map of traits associated with the identity
      Returns:
      the IdentityContext instance
    • getAdditionalProperties

      public Map<String,Object> getAdditionalProperties()
    • setAdditionalProperty

      public void setAdditionalProperty(String name, Object value)
      Set additional property.
      Parameters:
      name - the name
      value - the value
    • withAdditionalProperty

      public IdentityContext withAdditionalProperty(String name, Object value)
      Fluent setter for additional properties.
      Parameters:
      name - the name of the additional property
      value - the value of the additional property
      Returns:
      the IdentityContext instance
    • toString

      public String toString()
      Overrides:
      toString in class Object