|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.crsh.plugin.PropertyDescriptor<T>
public abstract class PropertyDescriptor<T>
Field Summary | |
---|---|
static Map<String,PropertyDescriptor<?>> |
ALL
. |
T |
defaultValue
. |
String |
description
. |
private static Map<String,PropertyDescriptor<?>> |
INTERNAL_ALL
. |
String |
name
. |
boolean |
secret
. |
static String |
SECRET_DISPLAY_VALUE
The display value returned when a property is secret. |
Class<T> |
type
. |
static PropertyDescriptor<Integer> |
VFS_REFRESH_PERIOD
. |
static PropertyDescriptor<TimeUnit> |
VFS_REFRESH_UNIT
. |
Constructor Summary | |
---|---|
protected |
PropertyDescriptor(Class<T> type,
String name,
T defaultValue,
String description)
Create a new property descriptor. |
protected |
PropertyDescriptor(Class<T> type,
String name,
T defaultValue,
String description,
boolean secret)
Create a new property descriptor. |
Method Summary | |
---|---|
static PropertyDescriptor<Integer> |
create(String name,
Integer defaultValue,
String description)
|
static PropertyDescriptor<Integer> |
create(String name,
Integer defaultValue,
String description,
boolean secret)
|
static PropertyDescriptor<List> |
create(String name,
List defaultValue,
String description)
|
static PropertyDescriptor<List> |
create(String name,
List defaultValue,
String description,
boolean secret)
|
static PropertyDescriptor<String> |
create(String name,
String defaultValue,
String description)
|
static PropertyDescriptor<String> |
create(String name,
String defaultValue,
String description,
boolean secret)
|
protected abstract T |
doParse(String s)
Implements the real parsing, the string argument must nto be null. |
boolean |
equals(Object obj)
|
String |
getDefaultDisplayValue()
|
T |
getDefaultValue()
|
String |
getDescription()
|
String |
getName()
|
Class<T> |
getType()
|
T |
parse(String s)
Parse a string representation of a value and returns the corresponding typed value. |
Property<T> |
toProperty(String s)
Parse a string representation of a value and returns the correspondig property value. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String SECRET_DISPLAY_VALUE
private static final Map<String,PropertyDescriptor<?>> INTERNAL_ALL
public static final Map<String,PropertyDescriptor<?>> ALL
public static final PropertyDescriptor<TimeUnit> VFS_REFRESH_UNIT
public static final PropertyDescriptor<Integer> VFS_REFRESH_PERIOD
public final Class<T> type
public final String name
public final T defaultValue
public final String description
public final boolean secret
Constructor Detail |
---|
protected PropertyDescriptor(Class<T> type, String name, T defaultValue, String description) throws NullPointerException
type
- the property typename
- the property namedefaultValue
- the default valuedescription
- the description
NullPointerException
- if the type, name or description is nullprotected PropertyDescriptor(Class<T> type, String name, T defaultValue, String description, boolean secret) throws NullPointerException
type
- the property typename
- the property namedefaultValue
- the default valuedescription
- the descriptionsecret
- the value is secret (like a password)
NullPointerException
- if the type, name or description is nullMethod Detail |
---|
public static PropertyDescriptor<String> create(String name, String defaultValue, String description, boolean secret)
public static PropertyDescriptor<String> create(String name, String defaultValue, String description)
public static PropertyDescriptor<Integer> create(String name, Integer defaultValue, String description, boolean secret)
public static PropertyDescriptor<Integer> create(String name, Integer defaultValue, String description)
public static PropertyDescriptor<List> create(String name, List defaultValue, String description, boolean secret)
public static PropertyDescriptor<List> create(String name, List defaultValue, String description)
public final String getName()
public final String getDescription()
public final Class<T> getType()
public final T getDefaultValue()
public final String getDefaultDisplayValue()
public final T parse(String s) throws NullPointerException, IllegalArgumentException
s
- the string to parse
NullPointerException
- if the argument is null
IllegalArgumentException
- if the string value cannot be parsed for some reasonpublic boolean equals(Object obj)
equals
in class Object
public final Property<T> toProperty(String s) throws NullPointerException, IllegalArgumentException
s
- the string to parse
NullPointerException
- if the argument is null
IllegalArgumentException
- if the string value cannot be parsed for some reasonprotected abstract T doParse(String s) throws Exception
s
- the string to parse
Exception
- any exception that would prevent parsing to hapenpublic final String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |