Class MapBackedEntity<T extends MapSyncable>


  • public class MapBackedEntity<T extends MapSyncable>
    extends MapBackedProperty<T>
    An Entity variable that can be represented as a key-value pair in the POJO internal Map
    • Constructor Summary

      Constructors 
      Constructor Description
      MapBackedEntity​(java.util.Map sourceMap, java.lang.String property, EntityInstantiator<T> entityInstantiator)
      Construct a MapBackedEntity with a certain property name and default value
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get()
      Retrieve the wrapped entity
      protected java.util.Optional<T> queryOption()
      Hook to allow the property to be queryable
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MapBackedEntity

        public MapBackedEntity​(java.util.Map sourceMap,
                               java.lang.String property,
                               EntityInstantiator<T> entityInstantiator)
        Construct a MapBackedEntity with a certain property name and default value
        Parameters:
        sourceMap - Map to store the Entity value in
        property - Key name of the property
        entityInstantiator - function to use when adding a value to the Entity
    • Method Detail

      • get

        public T get()
              throws com.legyver.core.exception.CoreException
        Retrieve the wrapped entity
        Overrides:
        get in class MapBackedProperty<T extends MapSyncable>
        Returns:
        the existing entity or an new Entity instantiated from the EntityInstantiator
        Throws:
        com.legyver.core.exception.CoreException - if there is a problem marshalling to/from JSON