Class MemoryConnection
- java.lang.Object
-
- com.aquima.interactions.foundation.connectivity.impl.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 Summary
Constructors Constructor Description MemoryConnection(String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(GUID id)
Check if this connection has an object for the given id.Object
get(GUID id)
Retrieve an object from the connection.String
getName()
This method returns the name of the connection object.ConnectionType
getType()
This method returns the type of the connection object.void
put(GUID id, Object item)
Store an object on the connection.void
remove(GUID id)
Remove an object from the connection.
-
-
-
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 interfaceIConnection
- 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 interfaceIConnection
- 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 interfaceIMemoryConnection
- 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 interfaceIMemoryConnection
- 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 interfaceIMemoryConnection
- 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 interfaceIMemoryConnection
- Parameters:
id
- The id of the object to remove, may not be null.
-
-