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

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and TypeMethodDescription
      default java.lang.ObjectgetPrivateData​(java.lang.String key)
      Gets an Object in the private storage map.
      default <T> TgetPrivateData​(java.lang.String key, java.lang.Class<T> clazz)
      Gets an Object in the private storage map of a specified class.
      java.util.Map<java.lang.String,​java.lang.Object>getPrivateStorageMap()
      Gets the concurrent hash map used to store the private data.
      default java.lang.ObjectsetPrivateData​(java.lang.String key, java.lang.Object data)
      Adds a new Object to the private storage map, overwriting existing objects.
    • Method Detail

      • getPrivateStorageMap

        java.util.Map<java.lang.String,​java.lang.Object> getPrivateStorageMap()
        Gets the concurrent hash map used to store the private data.
        Returns:
        The private storage map.
      • setPrivateData

        default java.lang.Object setPrivateData​(java.lang.String key,
                                                java.lang.Object data)
        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:
        java.lang.NullPointerException - If the key is null.
      • getPrivateData

        default java.lang.Object getPrivateData​(java.lang.String key)
        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:
        java.lang.NullPointerException - If the key is null.
      • getPrivateData

        default <T> T getPrivateData​(java.lang.String key,
                                     java.lang.Class<T> clazz)
        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).