Package io.getunleash.strategy
Class StrategyUtils
- java.lang.Object
-
- io.getunleash.strategy.StrategyUtils
-
public final class StrategyUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description StrategyUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetNormalizedNumber(String identifier, String groupId, int normalizer, long seed)static intgetNormalizedNumber(String identifier, String groupId, long seed)Takes to string inputs concat them, produce a hash and return a normalized value between 0 and 100;static intgetPercentage(String percentage)Takes a numeric string value and converts it to a integer between 0 and 100.static booleanisEmpty(CharSequence cs)static booleanisNotEmpty(CharSequence cs)static booleanisNumeric(CharSequence cs)
-
-
-
Method Detail
-
isNotEmpty
public static boolean isNotEmpty(CharSequence cs)
-
isEmpty
public static boolean isEmpty(@Nullable CharSequence cs)
-
isNumeric
public static boolean isNumeric(CharSequence cs)
-
getNormalizedNumber
public static int getNormalizedNumber(String identifier, String groupId, long seed)
Takes to string inputs concat them, produce a hash and return a normalized value between 0 and 100;- Parameters:
identifier-groupId-- Returns:
-
getNormalizedNumber
public static int getNormalizedNumber(String identifier, String groupId, int normalizer, long seed)
-
getPercentage
public static int getPercentage(String percentage)
Takes a numeric string value and converts it to a integer between 0 and 100.returns 0 if the string is not numeric.
- Parameters:
percentage- - A numeric string value- Returns:
- a integer between 0 and 100
-
-