Class Rule

java.lang.Object
io.featureflow.client.model.Rule

public class Rule extends Object
A Rule holds and Audience (Who to show to) and a list of VariantSplits (what to show them)
  • Field Details

  • Constructor Details

    • Rule

      public Rule()
  • Method Details

    • setAudience

      public void setAudience(Audience audience)
    • getAudience

      public Audience getAudience()
    • getVariantSplits

      public List<VariantSplit> getVariantSplits()
    • setVariantSplits

      public void setVariantSplits(List<VariantSplit> variantSplits)
    • matches

      public boolean matches(FeatureflowUser user)
    • getVariantSplitKey

      public String getVariantSplitKey(String userId, String featureKey, String salt)
    • getSplitKey

      public String getSplitKey(long variantValue)
    • getHash

      public String getHash(String userId, String featureKey, String salt)
      Generate the Variant value using sha1hex 1. We generate an equally distributed string of hex values, parse it to a length of 15, thats the max we can get before we blow out of the long range (fffffffffffffff)16 = (1152921504606846975)10 2. We turn that hex into its representative number 3. We find the remainder from 100 and use that as our variant bucket
      Parameters:
      userId - - the users unique identifier key or bucket key
      featureKey - - The feature key we are testing
      salt - - A salt value
      Returns:
      hash - the hashed value
    • getVariantValue

      public long getVariantValue(String hash)