|
XNIO API 2.1.0.CR2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.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)
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-readible string representation of this object. |
|
| 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 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)
throws IllegalArgumentException
string - the string
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 2.1.0.CR2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||