Class AbstractContainer<K>

java.lang.Object
com.marcusslover.plus.lib.container.AbstractContainer<K>
Type Parameters:
K - Value type.
Direct Known Subclasses:
MapContainer, SingleContainer

public abstract class AbstractContainer<K> extends Object
Abstract container that represents a parent of files, similar to a folder. Default implementations are MapContainer and SingleContainer.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final com.google.gson.Gson
     
    protected File
     
    protected org.bukkit.plugin.Plugin
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected @NotNull com.google.gson.Gson
    Gets the Gson instance.
    abstract void
    Attempts to load all the data from the container.
    abstract void
    update(K key)
    Push the updated object to the cache and save it to the file.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_GSON

      protected static final com.google.gson.Gson DEFAULT_GSON
    • parentFolder

      protected File parentFolder
    • plugin

      protected org.bukkit.plugin.Plugin plugin
  • Constructor Details

    • AbstractContainer

      public AbstractContainer()
  • Method Details

    • getGson

      @NotNull protected @NotNull com.google.gson.Gson getGson()
      Gets the Gson instance. By default, it is DEFAULT_GSON.
      Returns:
      Gson instance.
    • update

      public abstract void update(@NotNull K key)
      Push the updated object to the cache and save it to the file.
      Parameters:
      key - Key of the object.
    • loadAllData

      public abstract void loadAllData()
      Attempts to load all the data from the container. Look at InitialLoading for more information.