Class PersisterRegistry<T>

java.lang.Object
net.citizensnpcs.api.persistence.PersisterRegistry<T>
All Implemented Interfaces:
Persister<T>

public class PersisterRegistry<T> extends Object implements Persister<T>
A stringly-typed registry that loads and saves its types using PersistenceLoader and DataKeys.
  • Method Details

    • create

      public T create(DataKey root)
      Description copied from interface: Persister
      Creates an object instance from the given DataKey. Should not return null unless no data is present.
      Specified by:
      create in interface Persister<T>
      Parameters:
      root - The root key to load from
      Returns:
      The created instance, or null if no data was present
    • register

      public void register(String type, Class<? extends T> clazz)
    • registeredTypes

      public Iterable<Class<? extends T>> registeredTypes()
    • save

      public void save(T instance, DataKey root)
      Description copied from interface: Persister
      Saves the object instance to the given DataKey.
      Specified by:
      save in interface Persister<T>
      Parameters:
      instance - The object instance to save
      root - The key to save into