T
- the type of this variable (i.e., the type returned by
value()
).public class ApptimizeVar<T>
extends java.lang.Object
An Apptimize variable whose value can be changed in A/B experiments.
We can create them using the create
factory methods (e.g.,
createString(String, String)
,
createMapOfDoubles(String, java.util.Map)
).
We can get the value of an Apptimize variable using value()
. This
value will vary depending on what A/B experiment variants this device is
currently enrolled in.
Modifier and Type | Method and Description |
---|---|
static ApptimizeVar<java.lang.Boolean> |
createBoolean(java.lang.String name,
java.lang.Boolean defaultValue)
Creates an
ApptimizeVar with a Boolean value. |
static ApptimizeVar<java.lang.Double> |
createDouble(java.lang.String name,
java.lang.Double defaultValue)
Creates an
ApptimizeVar with a Double value. |
static ApptimizeVar<java.lang.Integer> |
createInteger(java.lang.String name,
java.lang.Integer defaultValue)
Creates an
ApptimizeVar with an Integer value. |
static ApptimizeVar<java.util.List<java.lang.Boolean>> |
createListOfBooleans(java.lang.String name,
java.util.List<java.lang.Boolean> defaultValue)
Creates an
ApptimizeVar with a List<Boolean> value. |
static ApptimizeVar<java.util.List<java.lang.Double>> |
createListOfDoubles(java.lang.String name,
java.util.List<java.lang.Double> defaultValue)
Creates an
ApptimizeVar with a List<Double> value. |
static ApptimizeVar<java.util.List<java.lang.Integer>> |
createListOfIntegers(java.lang.String name,
java.util.List<java.lang.Integer> defaultValue)
Creates an
ApptimizeVar with a List<Integer> value. |
static ApptimizeVar<java.util.List<java.lang.String>> |
createListOfStrings(java.lang.String name,
java.util.List<java.lang.String> defaultValue)
Creates an
ApptimizeVar with a List<String> value. |
static ApptimizeVar<java.util.Map<java.lang.String,java.lang.Boolean>> |
createMapOfBooleans(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Boolean> defaultValue)
Creates an
ApptimizeVar with a Map<String, Boolean>
value. |
static ApptimizeVar<java.util.Map<java.lang.String,java.lang.Double>> |
createMapOfDoubles(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Double> defaultValue)
Creates an
ApptimizeVar with a Map<String, Double> value. |
static ApptimizeVar<java.util.Map<java.lang.String,java.lang.Integer>> |
createMapOfIntegers(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Integer> defaultValue)
Creates an
ApptimizeVar with a Map<String, Integer>
value. |
static ApptimizeVar<java.util.Map<java.lang.String,java.lang.String>> |
createMapOfStrings(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> defaultValue)
Creates an
ApptimizeVar with a Map<String, String> value. |
static ApptimizeVar<java.lang.String> |
createString(java.lang.String name,
java.lang.String defaultValue)
Creates an
ApptimizeVar with a String value. |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
T |
value()
Gets the current value of this
ApptimizeVar . |
T |
value(ApptimizeOptions options)
Gets the current value of this
ApptimizeVar . |
public static ApptimizeVar<java.lang.String> createString(java.lang.String name, java.lang.String defaultValue)
ApptimizeVar
with a String
value.name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<String>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.lang.Integer> createInteger(java.lang.String name, java.lang.Integer defaultValue)
ApptimizeVar
with an Integer
value.name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<Integer>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.lang.Double> createDouble(java.lang.String name, java.lang.Double defaultValue)
ApptimizeVar
with a Double
value.name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<Double>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.lang.Boolean> createBoolean(java.lang.String name, java.lang.Boolean defaultValue)
ApptimizeVar
with a Boolean
value.name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<Boolean>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.util.List<java.lang.String>> createListOfStrings(java.lang.String name, java.util.List<java.lang.String> defaultValue)
Creates an ApptimizeVar
with a List<String>
value.
Note that when the ApptimizeVar
is created, its default value
will be set to a copy of the input defaultValue
rather than to
the original object. Any subsequent changes to the original input object
will not modify the default value of the returned ApptimizeVar
.
name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<List<String>>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.util.List<java.lang.Integer>> createListOfIntegers(java.lang.String name, java.util.List<java.lang.Integer> defaultValue)
Creates an ApptimizeVar
with a List<Integer>
value.
Note that when the ApptimizeVar
is created, its default value
will be set to a copy of the input defaultValue
rather than to
the original object. Any subsequent changes to the original input object
will not modify the default value of the returned ApptimizeVar
.
name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<List<Integer>>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.util.List<java.lang.Double>> createListOfDoubles(java.lang.String name, java.util.List<java.lang.Double> defaultValue)
Creates an ApptimizeVar
with a List<Double>
value.
Note that when the ApptimizeVar
is created, its default value
will be set to a copy of the input defaultValue
rather than to
the original object. Any subsequent changes to the original input object
will not modify the default value of the returned ApptimizeVar
.
name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<List<Double>>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.util.List<java.lang.Boolean>> createListOfBooleans(java.lang.String name, java.util.List<java.lang.Boolean> defaultValue)
Creates an ApptimizeVar
with a List<Boolean>
value.
Note that when the ApptimizeVar
is created, its default value
will be set to a copy of the input defaultValue
rather than to
the original object. Any subsequent changes to the original input object
will not modify the default value of the returned ApptimizeVar
.
name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<List<Boolean>>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.util.Map<java.lang.String,java.lang.String>> createMapOfStrings(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> defaultValue)
Creates an ApptimizeVar
with a Map<String, String>
value.
Note that when the ApptimizeVar
is created, its default value
will be set to a copy of the input defaultValue
rather than to
the original object. Any subsequent changes to the original input object
will not modify the default value of the returned ApptimizeVar
.
name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<Map<String, String>>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.util.Map<java.lang.String,java.lang.Integer>> createMapOfIntegers(java.lang.String name, java.util.Map<java.lang.String,java.lang.Integer> defaultValue)
Creates an ApptimizeVar
with a Map<String, Integer>
value.
Note that when the ApptimizeVar
is created, its default value
will be set to a copy of the input defaultValue
rather than to
the original object. Any subsequent changes to the original input object
will not modify the default value of the returned ApptimizeVar
.
name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<Map<String, Integer>>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.util.Map<java.lang.String,java.lang.Double>> createMapOfDoubles(java.lang.String name, java.util.Map<java.lang.String,java.lang.Double> defaultValue)
Creates an ApptimizeVar
with a Map<String, Double>
value.
Note that when the ApptimizeVar
is created, its default value
will be set to a copy of the input defaultValue
rather than to
the original object. Any subsequent changes to the original input object
will not modify the default value of the returned ApptimizeVar
.
name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<Map<String, Double>>
.java.lang.NullPointerException
- If the specified name
is null
.public static ApptimizeVar<java.util.Map<java.lang.String,java.lang.Boolean>> createMapOfBooleans(java.lang.String name, java.util.Map<java.lang.String,java.lang.Boolean> defaultValue)
Creates an ApptimizeVar
with a Map<String, Boolean>
value.
Note that when the ApptimizeVar
is created, its default value
will be set to a copy of the input defaultValue
rather than to
the original object. Any subsequent changes to the original input object
will not modify the default value of the returned ApptimizeVar
.
name
- The name of this ApptimizeVar
, as it will appear when
configuring A/B experiments at https://apptimize.com/admin/defaultValue
- The value of this ApptimizeVar
if this device is not
enrolled in any A/B experiments that affect this variable.ApptimizeVar<Map<String, Boolean>>
.java.lang.NullPointerException
- If the specified name
is null
.public T value(ApptimizeOptions options)
ApptimizeVar
. This value will vary
depending on what A/B experiment variants this device is currently
enrolled in. If this device is not enrolled in any A/B experiments that
affect this ApptimizeVar
, this method will return the default
value of this ApptimizeVar
.
Note that if you call this method and perform modifications on the
returned value, subsequent calls to this method will return new objects
without these modifications.
Options can be configured using the input
ApptimizeOptions
.options
- Options for configuring this method. See
ApptimizeOptions
ApptimizeVar
for this device.public T value()
ApptimizeVar
. This value will vary
depending on what A/B experiment variants this device is currently
enrolled in. If this device is not enrolled in any A/B experiments that
affect this ApptimizeVar
, this method will return the default
value of this ApptimizeVar
.
Note that even if you call this method and perform modifications on the
returned value, subsequent calls to this method will still return new
objects without these modifications.ApptimizeVar
for this device.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object