Class StorageLoader<Value extends Storable>

java.lang.Object
com.codingchili.core.storage.StorageLoader<Value>

public class StorageLoader<Value extends Storable> extends Object
Builder to load storage plugins.
  • Constructor Details

    • StorageLoader

      public StorageLoader()
    • StorageLoader

      public StorageLoader(CoreContext context)
      Creates a new storage loader
      Parameters:
      context - the context to use.
  • Method Details

    • withDB

      public StorageLoader<Value> withDB(String DB)
      Parameters:
      DB - database name to use, if unset defaults to application name.
      Returns:
      fluent.
    • withDB

      public StorageLoader<Value> withDB(String DB, String collection)
      Parameters:
      DB - database name to use, if unset uses application name.
      collection - collection name to use, if unset uses storable class name.
      Returns:
      fluent.
    • withValue

      public StorageLoader<Value> withValue(Class<Value> valueClass)
      Parameters:
      valueClass - the class to be stored.
      Returns:
      fluent.
    • withProperties

      public StorageLoader<Value> withProperties(io.vertx.core.json.JsonObject properties)
      Parameters:
      properties - implementation specific configuration options.
      Returns:
      fluent.
    • withPlugin

      public StorageLoader<Value> withPlugin(Class<? extends AsyncStorage> plugin)
      Parameters:
      plugin - a plugin implementing #AsyncStorage.
      Returns:
      fluent.
    • withCollection

      public StorageLoader<Value> withCollection(String collection)
      Parameters:
      collection - collection name to use, defaults to storables class name.
      Returns:
      fluent.
    • withPlugin

      public StorageLoader<Value> withPlugin(String plugin)
      Parameters:
      plugin - a plugin to store the given class, must implement #AsyncStorage
      Returns:
      fluent.
    • build

      public void build(io.vertx.core.Handler<io.vertx.core.AsyncResult<AsyncStorage<Value>>> handler)
      Loads the configured storage. Throws an exception if context, class or plugin is unset.
      Parameters:
      handler - completed when the storage is loaded.