java.lang.Object
com.ultikits.ultitools.interfaces.impl.data.json.JsonStore
All Implemented Interfaces:
DataStore

public class JsonStore extends Object implements DataStore
Json Data store.
Json存储方式抽象类
Version:
1.0.0
Author:
wisdomme
  • Field Details

    • dataOperatorMap

      private static final Map<Class<?>,Cached> dataOperatorMap
    • schedulerInitialized

      private static volatile boolean schedulerInitialized
    • storeLocation

      private final String storeLocation
  • Constructor Details

    • JsonStore

      public JsonStore(String storeLocation)
  • Method Details

    • initScheduler

      private static void initScheduler()
      Initialize the flush scheduler. Called lazily when first JsonStore is created. This avoids static initializer issues in test environments.
    • flushAllCaches

      static void flushAllCaches()
      Flush all cached data operators. This method is extracted from BukkitRunnable for testability.
    • getDataOperatorCount

      static int getDataOperatorCount()
      Get the number of registered data operators. Used for testing.
    • resetSchedulerState

      static void resetSchedulerState()
      Reset the scheduler state. Used for testing.
    • getOperator

      public <T extends BaseDataEntity<String>> DataOperator<T> getOperator(UltiToolsPlugin plugin, Class<T> dataEntity)
      Description copied from interface: DataStore
      Get data operation entity class.

      获取数据操作实体类

      Specified by:
      getOperator in interface DataStore
      Type Parameters:
      T - Must inherit BaseDataEntity
      Parameters:
      plugin - Plugin
      插件
      dataEntity - Data entity class
      数据实体类
      Returns:
      Data operation entity
      数据操作实体
    • getOperator

      public <T extends BaseDataEntity<String>> DataOperator<T> getOperator(File dataFolder, Class<T> dataEntity)
      Description copied from interface: DataStore
      Get data operator for an external plugin, scoped to the plugin's own data folder.

      获取外部插件的数据操作器,数据范围限定在插件自己的数据文件夹中。

      Specified by:
      getOperator in interface DataStore
      Type Parameters:
      T - entity type
      Parameters:
      dataFolder - the external plugin's data folder (e.g., plugins/MyPlugin/)
      dataEntity - data entity class
      Returns:
      data operator
    • destroyAllOperators

      public void destroyAllOperators()
      Description copied from interface: DataStore
      Save all possible caches and destroy all data operation classes.

      保存所有可能的缓存并销毁所有的数据操作类

      Specified by:
      destroyAllOperators in interface DataStore
    • getStoreType

      public String getStoreType()
      Description copied from interface: DataStore
      Get the type of data storage.

      获取此数据存储的类型

      Specified by:
      getStoreType in interface DataStore
      Returns:
      Data storage type
      数据存储类型