Class MemoryConnection

  • All Implemented Interfaces:
    IConnection, IMemoryConnection

    public class MemoryConnection
    extends Object
    implements IMemoryConnection
    Default implementation of IMemoryConnection. This implementation internally uses a HashMap to store objects. This map is unbound in size. Stored objects are not persisted in any way, resulting in a loss of all stored objects when the connection instance is garbage collected.
    Since:
    9.3
    Author:
    m.mahabiersing
    • Constructor Detail

      • MemoryConnection

        public MemoryConnection​(String name)
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: IConnection
        This method returns the name of the connection object. The name is used to uniquely identify the connection object.
        Specified by:
        getName in interface IConnection
        Returns:
        the name of the connection object.
      • getType

        public ConnectionType getType()
        Description copied from interface: IConnection
        This method returns the type of the connection object.
        Specified by:
        getType in interface IConnection
        Returns:
        the type of the connection object.
      • containsKey

        public boolean containsKey​(GUID id)
        Description copied from interface: IMemoryConnection
        Check if this connection has an object for the given id.
        Specified by:
        containsKey in interface IMemoryConnection
        Parameters:
        id - The id, never null
        Returns:
        Returns true if an entry exists, false otherwise.
      • get

        public Object get​(GUID id)
        Description copied from interface: IMemoryConnection
        Retrieve an object from the connection.
        Specified by:
        get in interface IMemoryConnection
        Parameters:
        id - The id of the object to retrieve.
        Returns:
        The object associated with the id, or null when the connection has no object for the given id.
      • put

        public void put​(GUID id,
                        Object item)
        Description copied from interface: IMemoryConnection
        Store an object on the connection.
        Specified by:
        put in interface IMemoryConnection
        Parameters:
        id - The id of the object to store.
        item - The object to store, may not be null.
      • remove

        public void remove​(GUID id)
        Description copied from interface: IMemoryConnection
        Remove an object from the connection.
        Specified by:
        remove in interface IMemoryConnection
        Parameters:
        id - The id of the object to remove, may not be null.