Class Identity

java.lang.Object
io.rtr.alchemy.identities.Identity

public abstract class Identity extends Object
Identifies a unique entity whose hash code is used for treatments allocation
  • Field Details

    • EMPTY

      protected static final Set<String> EMPTY
  • Constructor Details

    • Identity

      public Identity()
  • Method Details

    • getSupportedAttributes

      public static <T extends Identity> Set<String> getSupportedAttributes(Class<T> clazz)
      Get a list of possible attribute values that can be returned by this identity
    • computeHash

      public long computeHash(int seed, Set<String> hashAttributes, AttributesMap attributes)
      generates a hash code used to assign identity to treatment
      Parameters:
      seed - a seed value to randomize the resulting hash from experiment to experiment for the same identity
      hashAttributes - a set of attributes that should be used to compute the hash code
      attributes - a map of attribute values
    • computeAttributes

      public abstract AttributesMap computeAttributes()
      generates a list of attributes that describe this identity for filtering
    • identity

      protected IdentityBuilder identity(int seed)
      Convenience method for getting an identity builder given a seed
    • attributes

      protected AttributesMap.Builder attributes()
      Convenience method for getting an attributes map builder