Modifier and Type | Field and Description |
---|---|
private boolean |
defaultSelectedHandling |
private static GenericParser<Object> |
GENERIC_PARSER |
private static Pattern |
HEX_COLOR_PATTERN |
private Map<String,Object> |
prop |
Constructor and Description |
---|
Cascade()
Constructs a new
Cascade . |
Cascade(Cascade other)
Constructs a new
Cascade from existing one. |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
Checks if this cascade has a value for given key
|
static <T> T |
convertTo(Object o,
Class<T> klass)
Converts an object to a given other class.
|
Object |
get(String key)
Gets a property for the given key (like stroke, ...)
|
<T> T |
get(String key,
T def,
Class<T> klass)
Gets the value for a given key with the given type
|
<T> T |
get(String key,
T def,
Class<T> klass,
boolean suppressWarnings)
Get value for the given key
|
boolean |
isDefaultSelectedHandling()
Get if the default selection drawing should be used for the object this cascade applies to
|
void |
put(String key,
Object val)
Sets the property for the given key
|
void |
putOrClear(String key,
Object val)
Sets the property for the given key, removes it if the value is
null |
void |
remove(String key)
Removes the property with the given key
|
void |
setDefaultSelectedHandling(boolean defaultSelectedHandling)
Set that the default selection drawing should be used for the object this cascade applies to
|
private static Boolean |
toBool(Object o) |
private static Color |
toColor(Object o) |
private static Double |
toDouble(Object o) |
private static Float |
toFloat(Object o) |
private static float[] |
toFloatArray(Object o) |
String |
toString() |
private static String |
toString(Object o) |
private boolean defaultSelectedHandling
private static final Pattern HEX_COLOR_PATTERN
private static final GenericParser<Object> GENERIC_PARSER
public Cascade()
Cascade
.public <T> T get(String key, T def, Class<T> klass)
T
- the expected typekey
- the keydef
- default value, can be nullklass
- the same as Tpublic <T> T get(String key, T def, Class<T> klass, boolean suppressWarnings)
T
- the expected typekey
- the keydef
- default value, can be nullklass
- the same as TsuppressWarnings
- show or don't show a warning when some value is
found, but cannot be converted to the requested typepublic Object get(String key)
key
- The key of the propertynull
if it is not set. May be of any typepublic void put(String key, Object val)
key
- The keyval
- The valuepublic void putOrClear(String key, Object val)
null
key
- The keyval
- The value, may be null
public void remove(String key)
key
- The keypublic static <T> T convertTo(Object o, Class<T> klass)
T
- The class typeo
- The object to convertklass
- The classnull
if the conversion failedprivate static float[] toFloatArray(Object o)
public boolean containsKey(String key)
key
- The key to checktrue
if there is a valuepublic boolean isDefaultSelectedHandling()
true
to use the default selection drawingpublic void setDefaultSelectedHandling(boolean defaultSelectedHandling)
defaultSelectedHandling
- true
to use the default selection drawing