|
XNIO API 3.0.7.GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xnio.Option<T>
T - the option value typepublic abstract class Option<T>
A strongly-typed option to configure an aspect of a service or connection. Options are immutable and use identity comparisons
and hash codes. Options should always be declared as public static final members in order to support serialization.
| Nested Class Summary | |
|---|---|
static class |
Option.SetBuilder
A builder for an immutable option set. |
| Method Summary | ||
|---|---|---|
abstract T |
cast(Object o)
Return the given object as the type of this option. |
|
static Option<?> |
fromString(String name,
ClassLoader classLoader)
Get an option from a string name, using the given classloader. |
|
String |
getName()
Get the name of this option. |
|
abstract T |
parseValue(String string,
ClassLoader classLoader)
Parse a string value for this option. |
|
protected Object |
readResolve()
Resolve this instance for serialization. |
|
static
|
sequence(Class<?> declClass,
String name,
Class<T> elementType)
Create an option with a sequence type. |
|
static Option.SetBuilder |
setBuilder()
Create a builder for an immutable option set. |
|
static
|
simple(Class<?> declClass,
String name,
Class<T> type)
Create an option with a simple type. |
|
String |
toString()
Get a human-readable string representation of this object. |
|
static
|
type(Class<?> declClass,
String name,
Class<T> declType)
Create an option with a class type. |
|
static
|
typeSequence(Class<?> declClass,
String name,
Class<T> elementDeclType)
Create an option with a sequence-of-types type. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <T> Option<T> simple(Class<?> declClass,
String name,
Class<T> type)
declClass - the declaring class of the optionname - the (field) name of this optiontype - the class of the value associated with this option
public static <T> Option<Sequence<T>> sequence(Class<?> declClass,
String name,
Class<T> elementType)
declClass - the declaring class of the optionname - the (field) name of this optionelementType - the class of the sequence element value associated with this option
public static <T> Option<Class<? extends T>> type(Class<?> declClass,
String name,
Class<T> declType)
T - the type of the class object givendeclClass - the declaring class of the optionname - the (field) name of this optiondeclType - the class object for the type of the class object given
public static <T> Option<Sequence<Class<? extends T>>> typeSequence(Class<?> declClass,
String name,
Class<T> elementDeclType)
T - the type of the sequence element class object givendeclClass - the declaring class of the optionname - the (field) name of this optionelementDeclType - the class object for the type of the sequence element class object given
public String getName()
public String toString()
toString in class Object
public static Option<?> fromString(String name,
ClassLoader classLoader)
throws IllegalArgumentException
null, the bootstrap
classloader will be used.
name - the option stringclassLoader - the class loader
IllegalArgumentException - if the given option name is not valid
public abstract T cast(Object o)
throws ClassCastException
o - the object to cast
ClassCastException - if the object is not of a compatible type
public abstract T parseValue(String string,
ClassLoader classLoader)
throws IllegalArgumentException
string - the stringclassLoader - the class loader to use to parse the value
IllegalArgumentException - if the argument could not be parsed
protected final Object readResolve()
throws ObjectStreamException
ObjectStreamException - if the object could not be resolvedpublic static Option.SetBuilder setBuilder()
|
XNIO API 3.0.7.GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||