
T - the option value typepublic abstract class Option<T>
extends java.lang.Object
implements java.io.Serializable
public static final members in order to support serialization.| Modifier and Type | Class and Description |
|---|---|
static class |
Option.SetBuilder
A builder for an immutable option set.
|
| Modifier and Type | Method and Description |
|---|---|
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,
java.lang.ClassLoader classLoader)
Parse a string value for this option.
|
protected java.lang.Object |
readResolve()
Resolve this instance for serialization.
|
static <T> Option<Sequence<T>> |
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 <T> Option<T> |
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-readable string representation of this object.
|
static <T> Option<java.lang.Class<? extends T>> |
type(java.lang.Class<?> declClass,
java.lang.String name,
java.lang.Class<T> declType)
Create an option with a class type.
|
static <T> Option<Sequence<java.lang.Class<? extends T>>> |
typeSequence(java.lang.Class<?> declClass,
java.lang.String name,
java.lang.Class<T> elementDeclType)
Create an option with a sequence-of-types type.
|
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 optionpublic 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 optionpublic static <T> Option<java.lang.Class<? extends T>> type(java.lang.Class<?> declClass, java.lang.String name, java.lang.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 givenpublic static <T> Option<Sequence<java.lang.Class<? extends T>>> typeSequence(java.lang.Class<?> declClass, java.lang.String name, java.lang.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 givenpublic java.lang.String getName()
public java.lang.String toString()
toString in class java.lang.Objectpublic 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 loaderjava.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 castjava.lang.ClassCastException - if the object is not of a compatible typepublic abstract T parseValue(java.lang.String string, java.lang.ClassLoader classLoader) throws java.lang.IllegalArgumentException
string - the stringclassLoader - the class loader to use to parse the valuejava.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()
Copyright © 2010 JBoss, a division of Red Hat, Inc.