|
XNIO API 2.0.0.GA | |||||||||
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(java.lang.Object o)
Return the given object as the type of this option. |
|
static Option<?> |
fromString(java.lang.String name,
java.lang.ClassLoader classLoader)
Get an option from a string name, using the given classloader. |
|
java.lang.String |
getName()
Get the name of this option. |
|
abstract T |
parseValue(java.lang.String string)
Parse a string value for this option. |
|
protected java.lang.Object |
readResolve()
Resolve this instance for serialization. |
|
static
|
sequence(java.lang.Class<?> declClass,
java.lang.String name,
java.lang.Class<T> elementType)
Create an option with a sequence type. |
|
static Option.SetBuilder |
setBuilder()
Create a builder for an immutable option set. |
|
static
|
simple(java.lang.Class<?> declClass,
java.lang.String name,
java.lang.Class<T> type)
Create an option with a simple type. |
|
java.lang.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(java.lang.Class<?> declClass, java.lang.String name, java.lang.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(java.lang.Class<?> declClass, java.lang.String name, java.lang.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 java.lang.String getName()
public java.lang.String toString()
toString
in class java.lang.Object
public static Option<?> fromString(java.lang.String name, java.lang.ClassLoader classLoader) throws java.lang.IllegalArgumentException
null
, the bootstrap
classloader will be used.
name
- the option stringclassLoader
- the class loader
java.lang.IllegalArgumentException
- if the given option name is not validpublic abstract T cast(java.lang.Object o) throws java.lang.ClassCastException
o
- the object to cast
java.lang.ClassCastException
- if the object is not of a compatible typepublic abstract T parseValue(java.lang.String string) throws java.lang.IllegalArgumentException
string
- the string
java.lang.IllegalArgumentException
- if the argument could not be parsedprotected final java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.ObjectStreamException
- if the object could not be resolvedpublic static Option.SetBuilder setBuilder()
|
XNIO API 2.0.0.GA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |