Package org.forgerock.util
Class Option<T>
- java.lang.Object
-
- org.forgerock.util.Option<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getDefaultValue()
Returns the default value of thisOption
, can benull
.static <T> Option<T>
of(Class<T> type, T defaultValue)
Defines an option with the provided type and default value.static <T> Option<T>
withDefault(T defaultValue)
Defines a boolean option with the provided default value.
-
-
-
Method Detail
-
of
public static <T> Option<T> of(Class<T> type, T defaultValue)
Defines an option with the provided type and default value.- Type Parameters:
T
- The type of value associated with the option.- Parameters:
type
- The type of value associated with the option.defaultValue
- The default value for the option.- Returns:
- An option with the provided type and default value.
-
withDefault
public static <T> Option<T> withDefault(T defaultValue)
Defines a boolean option with the provided default value.- Type Parameters:
T
- The type of value associated with the option.- Parameters:
defaultValue
- The default value for the option.- Returns:
- A boolean option with the provided default value.
-
withDefault
public static <E extends Enum<E>,T extends E> Option<E> withDefault(T defaultValue)
Defines a boolean option with the provided default value.API Note: this is a specific overload which handles the case of enum values which are subclasses of the enum's class.
- Type Parameters:
E
- The type of value associated with the option.T
- The type of the enum value which is a subtype ofE
- Parameters:
defaultValue
- The default value for the option.- Returns:
- A boolean option with the provided default value.
-
-