Enum CassandraRelevantProperties

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<CassandraRelevantProperties>

    public enum CassandraRelevantProperties
    extends java.lang.Enum<CassandraRelevantProperties>
    A class that extracts system properties for the cassandra node it runs within.
    • Method Detail

      • values

        public static CassandraRelevantProperties[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CassandraRelevantProperties c : CassandraRelevantProperties.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CassandraRelevantProperties valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getKey

        public java.lang.String getKey()
      • getString

        public java.lang.String getString()
        Gets the value of the indicated system property.
        Returns:
        system property value if it exists, defaultValue otherwise.
      • getDefaultValue

        public java.lang.String getDefaultValue()
        Returns default value.
        Returns:
        default value, if any, otherwise null.
      • reset

        public void reset()
        Sets the property to its default value if a default value was specified. Remove the property otherwise.
      • getString

        public java.lang.String getString​(java.lang.String overrideDefaultValue)
        Gets the value of a system property as a String.
        Returns:
        system property String value if it exists, overrideDefaultValue otherwise.
      • convertToString

        public static java.lang.String convertToString​(@Nullable
                                                       java.lang.Object value)
      • setString

        public java.lang.String setString​(java.lang.String value)
        Sets the value into system properties.
        Parameters:
        value - to set
      • getBoolean

        public boolean getBoolean()
        Gets the value of a system property as a boolean.
        Returns:
        system property boolean value if it exists, false otherwise().
      • getBoolean

        public boolean getBoolean​(boolean overrideDefaultValue)
        Gets the value of a system property as a boolean.
        Returns:
        system property boolean value if it exists, overrideDefaultValue otherwise.
      • setBoolean

        public java.lang.Boolean setBoolean​(boolean value)
        Sets the value into system properties.
        Parameters:
        value - to set
        Returns:
        Previous value if it exists.
      • clearValue

        public void clearValue()
        Clears the value set in the system property.
      • getInt

        public int getInt()
        Gets the value of a system property as a int.
        Returns:
        System property value if it exists, defaultValue otherwise. Throws an exception if no default value is set.
      • getLong

        public long getLong()
        Gets the value of a system property as a long.
        Returns:
        System property value if it exists, defaultValue otherwise. Throws an exception if no default value is set.
      • getLong

        public long getLong​(long overrideDefaultValue)
        Gets the value of a system property as a long.
        Returns:
        system property long value if it exists, defaultValue otherwise.
      • getDouble

        public double getDouble()
        Gets the value of a system property as a double.
        Returns:
        System property value if it exists, defaultValue otherwise. Throws an exception if no default value is set.
      • getDouble

        public double getDouble​(double overrideDefaultValue)
        Gets the value of a system property as a double.
        Returns:
        system property value if it exists, defaultValue otherwise.
      • getSizeInBytes

        public long getSizeInBytes()
        Gets the value of a system property, given as a human-readable size in bytes (e.g. 100MiB, 10GB, 500B).
        Returns:
        System property value if it exists, defaultValue otherwise. Throws an exception if no default value is set.
      • getSizeInBytes

        public long getSizeInBytes​(long overrideDefaultValue)
        Gets the value of a system property, given as a human-readable size in bytes (e.g. 100MiB, 10GB, 500B).
        Returns:
        System property value if it exists, defaultValue otherwise.
      • getInt

        public int getInt​(int overrideDefaultValue)
        Gets the value of a system property as an int.
        Returns:
        system property int value if it exists, overrideDefaultValue otherwise.
      • setInt

        public java.lang.Integer setInt​(int value)
        Sets the value into system properties.
        Parameters:
        value - to set
        Returns:
        Previous value or null if it did not have one.
      • setLong

        public java.lang.Long setLong​(long value)
        Sets the value into system properties.
        Parameters:
        value - to set
        Returns:
        Previous value or null if it did not have one.
      • getEnum

        public <T extends java.lang.Enum<T>> T getEnum​(T defaultValue)
        Gets the value of a system property as a enum, calling String.toUpperCase() first.
        Type Parameters:
        T - type
        Parameters:
        defaultValue - to return when not defined
        Returns:
        enum value
      • getEnum

        public <T extends java.lang.Enum<T>> T getEnum​(boolean toUppercase,
                                                       T defaultValue)
        Gets the value of a system property as a enum, optionally calling String.toUpperCase() first.
        Type Parameters:
        T - type
        Parameters:
        toUppercase - before converting to enum
        defaultValue - to return when not defined
        Returns:
        enum value
      • getEnum

        public <T extends java.lang.Enum<T>> T getEnum​(boolean toUppercase,
                                                       java.lang.Class<T> enumClass)
        Gets the value of a system property as an enum, optionally calling String.toUpperCase() first. If the value is missing, the default value for this property is used
        Type Parameters:
        T - type
        Parameters:
        toUppercase - before converting to enum
        enumClass - enumeration class
        Returns:
        enum value
      • setEnum

        public void setEnum​(java.lang.Enum<?> value)
        Sets the value into system properties.
        Parameters:
        value - to set
      • isPresent

        public boolean isPresent()
        Returns:
        whether a system property is present or not.