java.lang.Object
com.github.startsmercury.simply.no.shading.util.storage.PathStorage<T>
com.github.startsmercury.simply.no.shading.util.storage.JsonPathStorage<T>
Type Parameters:
T - the supported type for storing
All Implemented Interfaces:
Storage<T>

@Deprecated(since="7.0.0", forRemoval=true) public class JsonPathStorage<T> extends PathStorage<T>
Deprecated, for removal: This API element is subject to removal in a future version.
No replacement
A JsonPathStorage is a concrete implementation of PathStorage in that serialized state is stored in the JSON file format.
Since:
6.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a new JsonPathStorage with a set path, defaulted gson, and without runtime type-checking.
    JsonPathStorage(Path path, com.google.gson.Gson gson)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a new JsonPathStorage with a set path, gson, and without runtime type-checking.
    JsonPathStorage(Path path, com.google.gson.Gson gson, Class<T> clazz)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a new JsonPathStorage with a set path, gson, and class.
    JsonPathStorage(Path path, com.google.gson.Gson gson, Type type)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a new JsonPathStorage with a set path, gson, and type.
    JsonPathStorage(Path path, Class<T> clazz)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a new JsonPathStorage with a set path, defaulted gson, and class.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.gson.Gson
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the gson used for (de)serialization.
    protected final com.google.gson.Gson
    Deprecated, for removal: This API element is subject to removal in a future version.
    This is a utility method wraps around getGson(), returning when not null; returns a fallback otherwise.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the supported type for storing.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Loads the stored state as a new object.
    void
    save(T obj)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Stores the state of a given object.

    Methods inherited from class com.github.startsmercury.simply.no.shading.util.storage.PathStorage

    equals, getPath, hashCode, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.github.startsmercury.simply.no.shading.util.storage.Storage

    loadAsync, saveAsync
  • Constructor Details

    • JsonPathStorage

      public JsonPathStorage(Path path)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new JsonPathStorage with a set path, defaulted gson, and without runtime type-checking.
      Parameters:
      path - the path where object state is (de)serialized
    • JsonPathStorage

      public JsonPathStorage(Path path, Class<T> clazz)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new JsonPathStorage with a set path, defaulted gson, and class.
      Parameters:
      path - the path where object state is (de)serialized
      clazz - the supported type
    • JsonPathStorage

      public JsonPathStorage(Path path, com.google.gson.Gson gson)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new JsonPathStorage with a set path, gson, and without runtime type-checking.
      Parameters:
      path - the path where object state is (de)serialized
      gson - the gson used for (de)serialization
    • JsonPathStorage

      public JsonPathStorage(Path path, com.google.gson.Gson gson, Class<T> clazz)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new JsonPathStorage with a set path, gson, and class.
      Parameters:
      path - the path where object state is (de)serialized
      gson - the gson used for (de)serialization
      clazz - the supported type
    • JsonPathStorage

      JsonPathStorage(Path path, com.google.gson.Gson gson, Type type)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new JsonPathStorage with a set path, gson, and type.
      Parameters:
      path - the path where object state is (de)serialized
      gson - the gson used for (de)serialization
      type - the supported type
  • Method Details

    • getGson

      public com.google.gson.Gson getGson()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the gson used for (de)serialization.
      Returns:
      the gson used for (de)serialization
    • getGsonElseFallback

      protected final com.google.gson.Gson getGsonElseFallback()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This is a utility method wraps around getGson(), returning when not null; returns a fallback otherwise.
      Returns:
      the gson used for (de)serialization
    • getType

      public Type getType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the supported type for storing.
      Returns:
      the supported type for storing
    • load

      public T load() throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Loads the stored state as a new object.
      Returns:
      a new object loaded with the stored state
      Throws:
      Exception - thrown when an implementation encountered a checked exception; the actual type may depend on the implementation
    • save

      public void save(T obj) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Stores the state of a given object.
      Parameters:
      obj - the object to store the state of
      Throws:
      Exception - thrown when an implementation encountered a checked exception; the actual type may depend on the implementation