Package com.complexible.common.base
Class Option<V>
- java.lang.Object
-
- com.complexible.common.base.Option<V>
-
public final class Option<V> extends java.lang.Object
Represents a configuration option. A configuration option is used as a key to get and set values from aOptions
structure. In addition, an option has a predefined default value.- Since:
- 2.0
- Version:
- 2.0
- Author:
- Evren Sirin
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> Option<T>
create(java.lang.String name)
Creates an option with the given name andnull
default value.static <T> Option<T>
create(java.lang.String name, T defaultValue)
Creates an option with the given name and default value.boolean
equals(java.lang.Object other)
V
getDefaultValue()
Returns the default value for this option.java.lang.String
getName()
int
hashCode()
void
setDefaultValue(V defaultValue)
Sets the default value for this option.java.lang.String
toString()
-
-
-
Constructor Detail
-
Option
protected Option(java.lang.String name, V defaultValue)
-
-
Method Detail
-
create
public static <T> Option<T> create(java.lang.String name)
Creates an option with the given name andnull
default value.
-
create
public static <T> Option<T> create(java.lang.String name, T defaultValue)
Creates an option with the given name and default value.
-
getDefaultValue
public V getDefaultValue()
Returns the default value for this option.
-
setDefaultValue
public void setDefaultValue(V defaultValue)
Sets the default value for this option. This will have a global effect.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getName
public java.lang.String getName()
-
-