public final class ExperimentFlag<T> extends Object
ExperimentState
can change depending on
the experiments that the ExperimentState
has been diverted into.
Instances of this class are created via the static factory methods defined in the
Experiments
namespace:
ExperimentFlag<Double> foo = Experiments.declare("foo_param", 17.29);
ExperimentFlag<Long> bar = Experiments.declare("bar_field", 13);
ExperimentFlag<String> baz = Experiments.declare("baz", "");
The value of an ExperimentFlag
for a request is retrieved from an
ExperimentState
:
ExperimentState myState = ...;
double fooValue = myState.get(foo);
float fooFloat = myState.getFloat(foo);
long barValue = myState.get(bar);
int barInt = myState.getInt(bar);
String bazStr = myState.get(baz);
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
T |
getDefaultValue()
Returns the default value of this flag, which is what will be returned when a call
to
ExperimentState.get(ExperimentFlag) is made before the ExperimentState
has been diverted by the ExperimentHandler . |
String |
getName()
Returns the name of this experiment flag, which should correspond to the name of
a parameter defined in the
ExperimentSpace . |
int |
hashCode() |
T |
parse(String value)
Converts the given string into an instance of the type
T of this flag. |
String |
toString() |
public String getName()
ExperimentSpace
.public T parse(String value)
T
of this flag.value
- the string form of the valueT
public T getDefaultValue()
ExperimentState.get(ExperimentFlag)
is made before the ExperimentState
has been diverted by the ExperimentHandler
.Copyright © 2013. All rights reserved.