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.ObjectRepresents a configuration option. A configuration option is used as a key to get and set values from aOptionsstructure. 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 andnulldefault value.static <T> Option<T>create(java.lang.String name, T defaultValue)Creates an option with the given name and default value.booleanequals(java.lang.Object other)VgetDefaultValue()Returns the default value for this option.java.lang.StringgetName()inthashCode()voidsetDefaultValue(V defaultValue)Sets the default value for this option.java.lang.StringtoString()
-
-
-
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 andnulldefault 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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getName
public java.lang.String getName()
-
-