|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.crsh.cli.type.ValueType<V>
V
- the generic value typepublic abstract class ValueType<V>
Defines a type for values, this is used for transforming a textual value into a type, for command argument and options. A value type defines:
parse(Class, String)
method that transforms the string into a value.Field Summary | |
---|---|
static ValueType<Boolean> |
BOOLEAN Boolean. |
protected Class<? extends Completer> |
completer . |
static ValueType<Enum> |
ENUM Any Java enum. |
static ValueType<File> |
FILE A value type for files. |
static ValueType<Integer> |
INTEGER Integer. |
static ValueType<ObjectName> |
OBJECT_NAME A JMX object name value type. |
static ValueType<Properties> |
PROPERTIES Properties as semi colon separated values. |
static ValueType<String> |
STRING Identity. |
static ValueType<Thread> |
THREAD A value type for threads. |
protected Class<V> |
type . |
Constructor Summary | |
---|---|
protected |
ValueType(Class<V> type) |
protected |
ValueType(Class<V> type, Class<? extends Completer> completer) |
Method Summary | ||
---|---|---|
boolean |
equals(Object obj) |
|
Class<? extends Completer> |
getCompleter() |
|
(package private) int |
getDistance(Class<?> clazz) |
|
Class<V> |
getType() |
|
int |
hashCode() |
|
abstract
|
parse(Class<S> type, String s) Parse the s argument into a value of type S that is a subclass of the generic value type V. |
|
V |
parse(String s) |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ValueType<String> STRING
public static final ValueType<Integer> INTEGER
public static final ValueType<Boolean> BOOLEAN
public static final ValueType<Enum> ENUM
public static final ValueType<Properties> PROPERTIES
public static final ValueType<ObjectName> OBJECT_NAME
public static final ValueType<Thread> THREAD
public static final ValueType<File> FILE
protected final Class<V> type
protected final Class<? extends Completer> completer
Constructor Detail |
---|
protected ValueType(Class<V> type, Class<? extends Completer> completer) throws NullPointerException
NullPointerException
protected ValueType(Class<V> type) throws NullPointerException
NullPointerException
Method Detail |
---|
final int getDistance(Class<?> clazz)
public final int hashCode()
hashCode
in class Object
public final boolean equals(Object obj)
equals
in class Object
public Class<? extends Completer> getCompleter()
public final Class<V> getType()
public final V parse(String s) throws Exception
Exception
public abstract <S extends V> S parse(Class<S> type, String s) throws Exception
s
argument into a value of type S that is a subclass of the generic value type V.
S
- the generic type of the converted valuetype
- the target type of the values
- the string to convertException
- any exception that would prevent the conversion to happen
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |