public final class Properties extends Object
GeoJSON properties serialize to/from a Map<String, Object>. To
simplify repeated property map creation where only one property might be
changing, this class provides a reusable builder. The class also provides
methods to help get and set simplestyle-spec (v1.1.0) properties that may be considered
when rendering GeoJSON online.
If a property map contains arrays or other nested objects as values, use
get(String) and cast to the appropriate type:
List<?>Map<String,?>| Modifier and Type | Class and Description |
|---|---|
static class |
Properties.Builder
Reusable property map builder.
|
static class |
Properties.Style
Identifiers for simplestyle-spec (v1.1.0) properties.
|
| Modifier and Type | Method and Description |
|---|---|
static Properties.Builder |
builder()
Return a reusable property map builder that preserves the order in which
properties are added.
|
boolean |
containsKey(Properties.Style key)
Return whether the supplied key exists in the property map
|
boolean |
containsKey(String key)
Return whether the supplied key exists in the property map
|
Object |
get(String key)
Return the value for the specified key as an object.
|
<T> T |
get(String key,
Class<T> classOfT)
Return the value for the specified key as an object of the specified class.
|
boolean |
getBoolean(String key)
Return the value for the specified key as an
boolean. |
double |
getDouble(Properties.Style key)
Return the value for the specified simplestyle key as an
double. |
double |
getDouble(String key)
Return the value for specified key as an
double. |
int |
getInt(String key)
Return the value for the specified key as an
int. |
String |
getString(Properties.Style key)
Return the value for the specified simplestyle key as an
String. |
String |
getString(String key)
Return the value for specified key as an
String. |
public boolean containsKey(String key)
key - to check forpublic boolean containsKey(Properties.Style key)
key - get value forpublic Object get(String key)
null as the property value.key - to get value forIllegalArgumentException - if no such property key existspublic <T> T get(String key, Class<T> classOfT)
T - the type of the desired objectkey - to get value forclassOfT - the class of TIllegalArgumentException - if no such property key existspublic boolean getBoolean(String key)
boolean.IllegalArgumentException - if no such property key existspublic int getInt(String key)
int.IllegalArgumentException - if no such property key existspublic double getDouble(String key)
double.IllegalArgumentException - if no such property key existspublic double getDouble(Properties.Style key)
double.NullPointerException - if no such property key existspublic String getString(String key)
String.NullPointerException - if no such property key existspublic String getString(Properties.Style key)
String.NullPointerException - if no such property key existspublic static Properties.Builder builder()
build() returns a copy of the internal map
instance.