Class 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.

    • Constructor Detail

      • SettingsUtil

        protected SettingsUtil()
        Default constructor.
    • 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 key
        value - 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
      • getEnvinronmentName

        protected static String getEnvinronmentName​(String key)
        Get an environment variable name.
        Parameters:
        key - a key
        Returns:
        a string