Package com.opencloud.slee.rest.common
Class ApiOption<T>
- java.lang.Object
-
- com.opencloud.slee.rest.common.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 charactersstatic ApiOption<java.lang.Boolean>
booleanOption(java.lang.String name)
Create a new configuration option, with a value that is a booleanstatic <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 Enumboolean
equals(java.lang.Object o)
int
hashCode()
T
initialValue()
Get the initial valuejava.lang.String
name()
Get the configuration option namestatic ApiOption<java.lang.String>
stringOption(java.lang.String name)
Create a new configuration option, with a value that is a non-empty Stringjava.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 URLVerifyResult
verify(T value)
Verify the validity of a value with respect to this 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 optiondefaultValue
- the default value of the configuration option- Returns:
- the new configuration option
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-