Class JSONDialect


  • public class JSONDialect
    extends Dialect
    Data dialect for JSON database
    • Constructor Detail

      • JSONDialect

        public JSONDialect​(@NotNull
                           @NotNull DataManager dataManager)
        Creates a new H2 dialect
        Parameters:
        dataManager - Dialect.dataManager
    • Method Detail

      • getFromCacheImpl

        @Nullable
        public @Nullable Value getFromCacheImpl​(@NotNull
                                                @NotNull java.lang.String table,
                                                @NotNull
                                                @NotNull java.lang.String target,
                                                @NotNull
                                                @NotNull java.lang.String key)
        Description copied from class: Dialect
        Get a value from the cache
        Specified by:
        getFromCacheImpl in class Dialect
        Parameters:
        table - the table
        target - the target
        key - the key
        Returns:
        the value inside a Value, null if it isn't cached
      • setToCacheImpl

        public void setToCacheImpl​(@NotNull
                                   @NotNull java.lang.String table,
                                   @NotNull
                                   @NotNull java.lang.String target,
                                   @NotNull
                                   @NotNull java.lang.String key,
                                   @NotNull
                                   @NotNull Value value)
        Description copied from class: Dialect
        Set a value to the cache
        Specified by:
        setToCacheImpl in class Dialect
        Parameters:
        table - the table
        target - the target
        key - the key
        value - the value inside a Value
      • markRemovedInCacheImpl

        public void markRemovedInCacheImpl​(@NotNull
                                           @NotNull java.lang.String table,
                                           @NotNull
                                           @NotNull java.lang.String target,
                                           @NotNull
                                           @NotNull java.lang.String key)
        Description copied from class: Dialect
        Mark a value as removed in the cache
        Specified by:
        markRemovedInCacheImpl in class Dialect
        Parameters:
        table - the table
        target - the target
        key - the key
      • saveCacheImpl

        public void saveCacheImpl()
        Description copied from class: Dialect
        Save all cache data to the database
        Specified by:
        saveCacheImpl in class Dialect
      • saveCacheImpl

        public void saveCacheImpl​(@NotNull
                                  @NotNull java.lang.String table,
                                  @NotNull
                                  @NotNull java.lang.String target)
        Description copied from class: Dialect
        Save a specific target in a table to the cache
        Specified by:
        saveCacheImpl in class Dialect
        Parameters:
        table - the table to save in
        target - the target to save
      • getMigrationDataFromDatabaseImpl

        @NotNull
        protected @NotNull java.util.Optional<Dialect.MigrationData> getMigrationDataFromDatabaseImpl​(@NotNull
                                                                                                      @NotNull DataManager newManager)
        Description copied from class: Dialect
        Get migration data from the database
        Specified by:
        getMigrationDataFromDatabaseImpl in class Dialect
        Parameters:
        newManager - the new DataManager to migrate to
        Returns:
        the migration data, empty if something went wrong
      • getFromDatabaseImpl

        @NotNull
        protected @NotNull java.util.Optional<java.lang.String> getFromDatabaseImpl​(@NotNull
                                                                                    @NotNull java.lang.String table,
                                                                                    @NotNull
                                                                                    @NotNull java.lang.String target,
                                                                                    @NotNull
                                                                                    @NotNull java.lang.String key)
        Description copied from class: Dialect
        Get a value from the database
        Specified by:
        getFromDatabaseImpl in class Dialect
        Parameters:
        table - the table to get from
        target - the target to get from
        key - the key to get
        Returns:
        the value, empty if not found
      • setToDatabaseImpl

        @Nullable
        protected @Nullable FailedSet setToDatabaseImpl​(@NotNull
                                                        @NotNull java.lang.String table,
                                                        @NotNull
                                                        @NotNull java.lang.String target,
                                                        @NotNull
                                                        @NotNull java.lang.String key,
                                                        @NotNull
                                                        @NotNull java.lang.String value)
        Description copied from class: Dialect
        Set a value to the database
        Specified by:
        setToDatabaseImpl in class Dialect
        Parameters:
        table - the table to set to
        target - the target to set to
        key - the key to set
        value - the value to set
        Returns:
        the failed value information, null if successful
      • setToDatabaseImpl

        @NotNull
        protected @NotNull java.util.Set<FailedSet> setToDatabaseImpl​(@NotNull
                                                                      @NotNull java.lang.String table,
                                                                      @NotNull
                                                                      @NotNull java.lang.String target,
                                                                      @NotNull
                                                                      @NotNull java.util.concurrent.ConcurrentHashMap<java.lang.String,​Value> data)
        Description copied from class: Dialect
        Set multiple values to the database
        Specified by:
        setToDatabaseImpl in class Dialect
        Parameters:
        table - the table to set to
        target - the target to set to
        data - the data to set
        Returns:
        set of failed values as FailedSets
      • removeFromDatabaseImpl

        protected boolean removeFromDatabaseImpl​(@NotNull
                                                 @NotNull java.lang.String table,
                                                 @NotNull
                                                 @NotNull java.lang.String target,
                                                 @NotNull
                                                 @NotNull java.lang.String key)
        Description copied from class: Dialect
        Remove a value from the database
        Specified by:
        removeFromDatabaseImpl in class Dialect
        Parameters:
        table - the table to remove from
        target - the target to remove from
        key - the key to remove
        Returns:
        true if the value was successfully removed, false otherwise