public final class Cascade extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
defaultSelectedHandling |
private static java.util.regex.Pattern |
HEX_COLOR_PATTERN |
private java.util.Map<java.lang.String,java.lang.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(java.lang.String key)
Checks if this cascade has a value for given key
|
static <T> T |
convertTo(java.lang.Object o,
java.lang.Class<T> klass)
Converts an object to a given other class.
|
java.lang.Object |
get(java.lang.String key)
Gets a property for the given key (like stroke, ...)
|
<T> T |
get(java.lang.String key,
T def,
java.lang.Class<T> klass)
Gets the value for a given key with the given type
|
<T> T |
get(java.lang.String key,
T def,
java.lang.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(java.lang.String key,
java.lang.Object val)
Sets the property for the given key
|
void |
putOrClear(java.lang.String key,
java.lang.Object val)
Sets the property for the given key, removes it if the value is
null |
void |
remove(java.lang.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 java.lang.Boolean |
toBool(java.lang.Object o) |
private static java.awt.Color |
toColor(java.lang.Object o) |
private static java.lang.Float |
toFloat(java.lang.Object o) |
private static float[] |
toFloatArray(java.lang.Object o) |
java.lang.String |
toString() |
private final java.util.Map<java.lang.String,java.lang.Object> prop
private boolean defaultSelectedHandling
private static final java.util.regex.Pattern HEX_COLOR_PATTERN
public Cascade()
Cascade
.public <T> T get(java.lang.String key, T def, java.lang.Class<T> klass)
T
- the expected typekey
- the keydef
- default value, can be nullklass
- the same as Tpublic <T> T get(java.lang.String key, T def, java.lang.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 java.lang.Object get(java.lang.String key)
key
- The key of the propertynull
if it is not set. May be of any typepublic void put(java.lang.String key, java.lang.Object val)
key
- The keyval
- The valuepublic void putOrClear(java.lang.String key, java.lang.Object val)
null
key
- The keyval
- The value, may be null
public void remove(java.lang.String key)
key
- The keypublic static <T> T convertTo(java.lang.Object o, java.lang.Class<T> klass)
T
- The class typeo
- The object to convertklass
- The classnull
if the conversion failedprivate static java.lang.Float toFloat(java.lang.Object o)
private static java.lang.Boolean toBool(java.lang.Object o)
private static float[] toFloatArray(java.lang.Object o)
private static java.awt.Color toColor(java.lang.Object o)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean containsKey(java.lang.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