- java.lang.Object
-
- com.legyver.utils.mapqua.mapbacked.MapBackedProperty<java.util.Map>
-
- com.legyver.utils.mapqua.mapbacked.MapBackedMap
-
public class MapBackedMap extends MapBackedProperty<java.util.Map>
A Map variable that can be represented as a key-value pair in the POJO internal Map
-
-
Field Summary
-
Fields inherited from class com.legyver.utils.mapqua.mapbacked.MapBackedProperty
property, sourceMap, valueIfMissing
-
-
Constructor Summary
Constructors Constructor Description MapBackedMap(java.util.Map sourceMap, java.lang.String property)Construct a MapBackedMap with a certain property name.MapBackedMap(java.util.Map sourceMap, java.lang.String property, java.util.Map valueIfMissing)Construct a MapBackedMap with a certain property name and default value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Mapget()Retrieve the Map value from the POJO internal Mapjava.lang.Objectget(java.lang.String key)Retrieve a value from the internal mapvoidput(java.lang.String key, java.lang.Object value)Put a value in the internal mapprotected java.util.Optional<java.util.Map>queryOption()Hook to allow the value to be queryable-
Methods inherited from class com.legyver.utils.mapqua.mapbacked.MapBackedProperty
set
-
-
-
-
Constructor Detail
-
MapBackedMap
public MapBackedMap(java.util.Map sourceMap, java.lang.String property, java.util.Map valueIfMissing)Construct a MapBackedMap with a certain property name and default value- Parameters:
sourceMap- Map to store the Map value inproperty- Key name of the propertyvalueIfMissing- value to set if missing
-
MapBackedMap
public MapBackedMap(java.util.Map sourceMap, java.lang.String property)Construct a MapBackedMap with a certain property name. THe default value will be a LinkedHashMap- Parameters:
sourceMap- Map to store the Map value inproperty- Key name of the property
-
-
Method Detail
-
get
public java.util.Map get() throws com.legyver.core.exception.CoreExceptionRetrieve the Map value from the POJO internal Map- Overrides:
getin classMapBackedProperty<java.util.Map>- Returns:
- the Map associated with the property name specified in the constructor
- Throws:
com.legyver.core.exception.CoreException- if there is a problem marshalling to/from JSON
-
put
public void put(java.lang.String key, java.lang.Object value)Put a value in the internal map- Parameters:
key- key to usevalue- value to use
-
get
public java.lang.Object get(java.lang.String key)
Retrieve a value from the internal map- Parameters:
key- vey name of the value- Returns:
- the value associated with the key
-
queryOption
protected java.util.Optional<java.util.Map> queryOption()
Hook to allow the value to be queryable- Specified by:
queryOptionin classMapBackedProperty<java.util.Map>- Returns:
- Optional.empty() as this is not supported
-
-