Class Cascade
java.lang.Object
org.openstreetmap.josm.gui.mappaint.Cascade
Simple map of properties with dynamic typing.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate static final GenericParser<Object>private static final Pattern -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) Checks if this cascade has a value for given keystatic <T> TConverts an object to a given other class.Gets a property for the given key (like stroke, ...)<T> TGets the value for a given key with the given type<T> TGet value for the given keybooleanGet if the default selection drawing should be used for the object this cascade applies tovoidSets the property for the given keyvoidputOrClear(String key, Object val) Sets the property for the given key, removes it if the value isnullvoidRemoves the property with the given keyvoidsetDefaultSelectedHandling(boolean defaultSelectedHandling) Set that the default selection drawing should be used for the object this cascade applies toprivate static Booleanprivate static Colorprivate static Doubleprivate static Floatprivate static float[]toString()private static String
-
Field Details
-
prop
-
defaultSelectedHandling
-
HEX_COLOR_PATTERN
-
GENERIC_PARSER
-
-
Constructor Details
-
Cascade
public Cascade()Constructs a newCascade. -
Cascade
Constructs a newCascadefrom existing one.- Parameters:
other- other Cascade
-
-
Method Details
-
get
Gets the value for a given key with the given type- Type Parameters:
T- the expected type- Parameters:
key- the keydef- default value, can be nullklass- the same as T- Returns:
- if a value that can be converted to class klass has been mapped to key, returns this value, def otherwise
-
get
Get value for the given key- Type Parameters:
T- the expected type- Parameters:
key- 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 type- Returns:
- if a value that can be converted to class klass has been mapped to key, returns this value, def otherwise
-
get
Gets a property for the given key (like stroke, ...)- Parameters:
key- The key of the property- Returns:
- The value or
nullif it is not set. May be of any type
-
put
Sets the property for the given key- Parameters:
key- The keyval- The value
-
putOrClear
Sets the property for the given key, removes it if the value isnull- Parameters:
key- The keyval- The value, may benull
-
remove
Removes the property with the given key- Parameters:
key- The key
-
convertTo
Converts an object to a given other class. Only conversions that are useful for MapCSS are supported- Type Parameters:
T- The class type- Parameters:
o- The object to convertklass- The class- Returns:
- The converted object or
nullif the conversion failed
-
toString
-
toFloat
-
toDouble
-
toBool
-
toFloatArray
-
toColor
-
toString
-
containsKey
Checks if this cascade has a value for given key- Parameters:
key- The key to check- Returns:
trueif there is a value
-
isDefaultSelectedHandling
Get if the default selection drawing should be used for the object this cascade applies to- Returns:
trueto use the default selection drawing
-
setDefaultSelectedHandling
Set that the default selection drawing should be used for the object this cascade applies to- Parameters:
defaultSelectedHandling-trueto use the default selection drawing
-