public abstract class AbstractProperty<T> extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
protected String |
description
Short description of the property.
|
protected Set<T> |
fixedValues
If value have a limited set of values.
|
protected String |
name
Unique name for property.
|
protected String |
type
Canonical name for JSON serialization.
|
protected T |
value
Current Value.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractProperty()
Default constructor.
|
protected |
AbstractProperty(String name)
Constructor by property name.
|
protected |
AbstractProperty(String name,
String value)
Constructor with name and value as String.
|
protected |
AbstractProperty(String name,
T value,
T... fixed)
Constructor with name , value and target available values
|
| Modifier and Type | Method and Description |
|---|---|
void |
add2FixedValue(T value)
Add element to fixed values.
|
void |
add2FixedValueFromString(String v)
Help XML parsing to realize downcastings.
|
boolean |
asBoolean()
Return value as boolean if possible.
|
double |
asDouble()
Return value as double if possible.
|
int |
asInt()
Return value as int (if possible).
|
String |
asString()
Serialized value as String
|
abstract T |
fromString(String v)
Unmarshalling of value for serailized string expression.
|
String |
getDescription()
Getter accessor for attribute 'description'.
|
Set<T> |
getFixedValues()
Getter accessor for attribute 'fixedValues'.
|
String |
getName()
Getter accessor for attribute 'name'.
|
String |
getType()
Getter accessor for attribute 'type'.
|
T |
getValue()
Getter accessor for attribute 'value'.
|
Class<T> |
parameterizedType()
Check dynamically the class of the parameter T.
|
void |
setDescription(String description)
Setter accessor for attribute 'description'.
|
void |
setFixedValues(Set<T> fixedValues)
Setter accessor for attribute 'fixedValues'.
|
void |
setName(String name)
Setter accessor for attribute 'name'.
|
void |
setType(String type)
Setter accessor for attribute 'type'.
|
void |
setValue(T value)
Setter accessor for attribute 'value'.
|
void |
setValueFromString(String value)
Load value from its string expression.
|
String |
toJson() |
String |
toString() |
protected String name
protected String description
protected String type
protected T value
protected AbstractProperty()
protected AbstractProperty(String name)
name - unique property nameprotected AbstractProperty(String name, String value)
name - current namevalue - current valuepublic void add2FixedValueFromString(String v)
v - current value as Stringpublic void add2FixedValue(T value)
value - current valuepublic abstract T fromString(String v)
v - value represented as a serialized Stringpublic Class<T> parameterizedType()
Exception - error on reading typepublic String asString()
public int asInt()
public double asDouble()
public boolean asBoolean()
public T getValue()
public void setValue(T value)
value - new value for 'value 'public void setValueFromString(String value)
value - current string valuepublic String getName()
public void setName(String name)
name - new value for 'name 'public Set<T> getFixedValues()
public void setFixedValues(Set<T> fixedValues)
fixedValues - new value for 'fixedValues 'public String toJson()
public String getType()
public void setType(String type)
type - new value for 'type 'public String getDescription()
public void setDescription(String description)
description - new value for 'description 'Copyright © 2013–2015 FF4J. All rights reserved.