Class ApiOption<T>

  • Type Parameters:
    T - the type associated with the configuration option.

    public final class ApiOption<T>
    extends java.lang.Object
    A configuration option.
    • Constructor Summary

      Constructors 
      Constructor Description
      ApiOption​(java.lang.String name)
      Create a new configuration option
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ApiOption<java.lang.String> base64PasswordOption​(java.lang.String name)
      Create a new configuration option, with a value that is a String containing base64 characters
      static ApiOption<java.lang.Boolean> booleanOption​(java.lang.String name)
      Create a new configuration option, with a value that is a boolean
      static <E extends java.lang.Enum<E>>
      ApiOption<E>
      enumOption​(java.lang.String name, E defaultValue)
      Create a new configuration option, with a value that is an Enum
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      T initialValue()
      Get the initial value
      java.lang.String name()
      Get the configuration option name
      static ApiOption<java.lang.String> stringOption​(java.lang.String name)
      Create a new configuration option, with a value that is a non-empty String
      java.lang.String toString()  
      static ApiOption<java.lang.String> urlOption​(java.lang.String name)
      Create a new configuration option, with a value that is a valid URL
      VerifyResult verify​(T value)
      Verify the validity of a value with respect to this configuration option
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ApiOption

        public ApiOption​(java.lang.String name)
        Create a new configuration option
        Parameters:
        name - the name of the configuration option
    • Method Detail

      • name

        public java.lang.String name()
        Get the configuration option name
        Returns:
        the name of the configuration option
      • initialValue

        public T initialValue()
        Get the initial value
        Returns:
        the initial value of this configuration option
      • verify

        public VerifyResult verify​(T value)
        Verify the validity of a value with respect to this configuration option
        Parameters:
        value - the value to verify
        Returns:
        the outcome of verifying the configuration option value
      • stringOption

        public static ApiOption<java.lang.String> stringOption​(java.lang.String name)
        Create a new configuration option, with a value that is a non-empty String
        Parameters:
        name - the name of the configuration option
        Returns:
        the new configuration option
      • urlOption

        public static ApiOption<java.lang.String> urlOption​(java.lang.String name)
        Create a new configuration option, with a value that is a valid URL
        Parameters:
        name - the name of the configuration option
        Returns:
        the new configuration option
      • base64PasswordOption

        public static ApiOption<java.lang.String> base64PasswordOption​(java.lang.String name)
        Create a new configuration option, with a value that is a String containing base64 characters
        Parameters:
        name - the name of the configuration option
        Returns:
        the new configuration option
      • booleanOption

        public static ApiOption<java.lang.Boolean> booleanOption​(java.lang.String name)
        Create a new configuration option, with a value that is a boolean
        Parameters:
        name - the name of the configuration option
        Returns:
        the new configuration option
      • enumOption

        public static <E extends java.lang.Enum<E>> ApiOption<E> enumOption​(java.lang.String name,
                                                                            E defaultValue)
        Create a new configuration option, with a value that is an Enum
        Type Parameters:
        E - the Enum type
        Parameters:
        name - the name of the configuration option
        defaultValue - the default value of the configuration option
        Returns:
        the new configuration option
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object