Class 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
    • 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.Map get()
      Retrieve the Map value from the POJO internal Map
      java.lang.Object get​(java.lang.String key)
      Retrieve a value from the internal map
      void put​(java.lang.String key, java.lang.Object value)
      Put a value in the internal map
      protected java.util.Optional<java.util.Map> queryOption()
      Hook to allow the value to be queryable
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 in
        property - Key name of the property
        valueIfMissing - 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 in
        property - Key name of the property
    • Method Detail

      • get

        public java.util.Map get()
                          throws com.legyver.core.exception.CoreException
        Retrieve the Map value from the POJO internal Map
        Overrides:
        get in class MapBackedProperty<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 use
        value - 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:
        queryOption in class MapBackedProperty<java.util.Map>
        Returns:
        Optional.empty() as this is not supported