Package com.iizix.api
Interface IPrivateStorage
- All Known Subinterfaces:
IAppSessionGyro
,IClientSessionGyro
- All Known Implementing Classes:
AppSessionGyro
,ClientSessionGyro
,EditorVirtualSpace
,SessionInfo
,VirtualSpace
public interface IPrivateStorage
The private storage interface is used in components in order to provide a programmatic storage that lives with the component it is attached to. An example would be the
VirtualSpace
that implements this interface enabling VirtualSpace instances to share data between client sessions. Other examples are the Application/Client Session Gyro's that implement the same interface. In other words your can have objects that live in with the VirtualSpace Object in question, the user's application or client session (note that a user can have several client session per application session).- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptiondefault Object
getPrivateData
(String key) Gets an Object in the private storage map.default <T> T
getPrivateData
(String key, Class<T> clazz) Gets an Object in the private storage map of a specified class.Gets the concurrent hash map used to store the private data.default Object
setPrivateData
(String key, Object data) Adds a new Object to the private storage map, overwriting existing objects.
Method Details
getPrivateStorageMap
Gets the concurrent hash map used to store the private data.- Returns:
- The private storage map.
setPrivateData
Adds a new Object to the private storage map, overwriting existing objects.- Parameters:
key
- The key for the data, not null.data
- The data Object,null
to remove the key.- Returns:
- A previously overwritten or removed object, or
null
if none were present. - Throws:
NullPointerException
- If thekey
is null.
getPrivateData
Gets an Object in the private storage map.- Parameters:
key
- The key for the data, not null.- Returns:
- The object for the key,
null
if none is present. - Throws:
NullPointerException
- If thekey
is null.
getPrivateData
Gets an Object in the private storage map of a specified class.If the object exists but is of wrong class, an error is logged.
A warning is logged in the server if the key was present but did not contain the expected class of the object in question. The warning will also include a stack trace for debugging purposes.
- Type Parameters:
T
- The object class requested.- Parameters:
key
- The key for the data, not null.clazz
- The class of the object.- Returns:
- The Object for the specified key, null for none (or not of the correct class).