- java.lang.Object
-
- com.github.f4b6a3.uuid.util.internal.SettingsUtil
-
public final class SettingsUtil extends Object
Utility class that reads system properties and environment variables.List of system properties:
- uuidcreator.node
- uuidcreator.securerandom
List of environment variables:
- UUIDCREATOR_NODE
- UUIDCREATOR_SECURERANDOM
System properties has prevalence over environment variables.
-
-
Field Summary
Fields Modifier and Type Field Description static StringPROPERTY_NODEThe property name for the node number.protected static StringPROPERTY_PREFIXThe property name prefix.static StringPROPERTY_SECURERANDOMThe property name for the secure random algorithm.
-
Constructor Summary
Constructors Modifier Constructor Description protectedSettingsUtil()Default constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearProperty(String key)Clear a property.protected static StringgetEnvinronmentName(String key)Get an environment variable name.static LonggetNodeIdentifier()Get the node identifier.static StringgetProperty(String name)Get a property.protected static StringgetPropertyName(String key)Get a property name.static StringgetSecureRandom()Get the secure random algorithm.static voidsetNodeIdentifier(Long node)Set the node identifierstatic voidsetProperty(String key, String value)Set a property.static voidsetSecureRandom(String algorithm)Set the secure random algorithm
-
-
-
Field Detail
-
PROPERTY_PREFIX
protected static final String PROPERTY_PREFIX
The property name prefix.- See Also:
- Constant Field Values
-
PROPERTY_NODE
public static final String PROPERTY_NODE
The property name for the node number.- See Also:
- Constant Field Values
-
PROPERTY_SECURERANDOM
public static final String PROPERTY_SECURERANDOM
The property name for the secure random algorithm.- See Also:
- Constant Field Values
-
-
Method Detail
-
getNodeIdentifier
public static Long getNodeIdentifier()
Get the node identifier.- Returns:
- a number
-
setNodeIdentifier
public static void setNodeIdentifier(Long node)
Set the node identifier- Parameters:
node- a number
-
getSecureRandom
public static String getSecureRandom()
Get the secure random algorithm.- Returns:
- a string
-
setSecureRandom
public static void setSecureRandom(String algorithm)
Set the secure random algorithm- Parameters:
algorithm- a string
-
getProperty
public static String getProperty(String name)
Get a property.- Parameters:
name- the name- Returns:
- a string
-
setProperty
public static void setProperty(String key, String value)
Set a property.- Parameters:
key- the keyvalue- the value
-
clearProperty
public static void clearProperty(String key)
Clear a property.- Parameters:
key- the key
-
getPropertyName
protected static String getPropertyName(String key)
Get a property name.- Parameters:
key- a key- Returns:
- a string
-
-