Interface DataRegistration


  • public interface DataRegistration
    An optional registration of keys to associate a semi-persistent state of their associated values that can be stored, retrieved, persisted, and/or associated with DataHolders. A registration identifies the given Keys are provided by an implementation for specific DataHolders that may support and not support those keys. All API provided keys exposed through the Keys class will have an associated registration by the implementation of the API, whether they are usable through DataProviders or DataStores.

    If dynamic or persistent retention of the Values by keys is not desired, a registration is optional. This would mean that any submitted Values of a Key without an associated DataRegistration will be only stored on a mutable DataHolder for the duration that that holder exists. The value would not persist between reloads, restarts, etc.

    • Method Detail

      • dataStore

        Optional<DataStore> dataStore​(io.leangen.geantyref.TypeToken<? extends DataHolder> token)
        Gets the appropriate DataStore for the context of the TypeToken that is being serialized/deserialized. It is always possible that there may be a DataStore that does not support the provided TypeToken, while a DataProvider may be provided for a particular Key.
        Parameters:
        token - The type token of the desired ValueContainer
        Returns:
        The relevant DataStore for the desired type token of the target type.
      • dataStore

        Optional<DataStore> dataStore​(Class<? extends DataHolder> token)
        Gets the appropriate DataStore for the context of the TypeToken that is being serialized/deserialized. It is always possible that there may be a DataStore that does not support the provided Class, while a DataProvider may be provided for a particular Key.
        Parameters:
        token - The class of the desired ValueContainer. Cannot be a raw type
        Returns:
        The relevant DataStore for the desired type token of the target type.
      • keys

        Iterable<Key<?>> keys()
        Gets the registered Keys this controls. Note that each Key can only be registered/owned by a single PluginContainer. It is possible for there to be only a single key registered, or multiple, depending on the basis of what potentially grouped values are controlled by a single DataStore or multiple DataProviders, based on the supported DataHolders.
        Returns:
        The keys registered
      • of

        @SafeVarargs
        static <T,​V extends Value<T>> DataRegistration of​(Key<V> key,
                                                                Class<? extends DataHolder> dataHolder,
                                                                Class<? extends DataHolder>... dataHolders)
        Creates a DataRegistration for a single key with a DataStore for given data-holders.
        Type Parameters:
        T - the value's type
        V - the value type
        Parameters:
        key - the data key
        dataHolders - the data-holders
        Returns:
        The built data registration