public class FeatureToggles extends Object
static final fields of the class the toggle controls.
All methods in this class returns the default value if the system property has not been assigned, or if the value of
the system property cannot be interpreted as a value of the expected type.
For features that the user is ever expected to touch, feature toggles is the wrong abstraction!| Modifier and Type | Method and Description |
|---|---|
static void |
clear(Class<?> location,
String name)
Clear the value of a system property.
|
static boolean |
flag(Class<?> location,
String name,
boolean defaultValue)
Get the value of a
boolean system property. |
static <E extends Enum<E>> |
flag(Class<?> location,
String name,
E defaultValue)
Get the value of a
enum system property. |
static double |
getDouble(Class<?> location,
String name,
double defaultValue)
Get the value of a
double system property. |
static int |
getInteger(Class<?> location,
String name,
int defaultValue)
Get the value of a
int system property. |
static long |
getLong(Class<?> location,
String name,
long defaultValue)
Get the value of a
long system property. |
static String |
getString(Class<?> location,
String name,
String defaultValue)
Get the value of a
String system property. |
static boolean |
packageFlag(Class<?> location,
String name,
boolean defaultValue)
Get the value of a
boolean system property. |
static void |
set(Class<?> location,
String name,
Object value)
Set the value of a system property.
|
static String |
toggle(Class<?> location,
String name,
Object value)
Helps creating a JVM parameter for setting a feature toggle of an arbitrary type.
|
public static boolean flag(Class<?> location, String name, boolean defaultValue)
boolean system property.
The absolute name of the system property is computed based on the provided class and local name.location - the class that owns the flag.name - the local name of the flag.defaultValue - the default value of the flag if the system property is not assigned.public static boolean packageFlag(Class<?> location, String name, boolean defaultValue)
boolean system property.
The absolute name of the system property is computed based on the package of the provided class and local name.location - a class in the package that owns the flag.name - the local name of the flag.defaultValue - the default value of the flag if the system property is not assigned.public static long getLong(Class<?> location, String name, long defaultValue)
long system property.
The absolute name of the system property is computed based on the provided class and local name.location - the class that owns the flag.name - the local name of the flag.defaultValue - the default value of the flag if the system property is not assigned.public static int getInteger(Class<?> location, String name, int defaultValue)
int system property.
The absolute name of the system property is computed based on the provided class and local name.location - the class that owns the flag.name - the local name of the flag.defaultValue - the default value of the flag if the system property is not assigned.public static double getDouble(Class<?> location, String name, double defaultValue)
double system property.
The absolute name of the system property is computed based on the provided class and local name.location - the class that owns the flag.name - the local name of the flagdefaultValue - the default value of the flag if the system property is not assigned.public static String getString(Class<?> location, String name, String defaultValue)
String system property.
The absolute name of the system property is computed based on the provided class and local name.
location - the class that owns the flag.name - the local name of the flagdefaultValue - the default value of the flag if the system property is not assigned.public static <E extends Enum<E>> E flag(Class<?> location, String name, E defaultValue)
enum system property.
The absolute name of the system property is computed based on the provided class and local name.E - the enum value type.location - the class that owns the flag.name - the local name of the flag.defaultValue - the default value of the flag if the system property is not assigned.public static void set(Class<?> location, String name, Object value)
The name of the system property is computed based on the provided class and local name.
location - the class that owns the flag.name - the local name of the flag.value - the value to assign to the system property.public static void clear(Class<?> location, String name)
The name of the system property is computed based on the provided class and local name.
location - the class that owns the flag.name - the local name of the flag.public static String toggle(Class<?> location, String name, Object value)
Objects.toString(Object) method.location - the class that owns the flag.name - the local name of the flag.value - the value to assign to the feature toggle.Copyright © 2002–2016 The Neo4j Graph Database Project. All rights reserved.