Package com.codingchili.core.storage
Class StorageLoader<Value extends Storable>
java.lang.Object
com.codingchili.core.storage.StorageLoader<Value>
Builder to load storage plugins.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild(io.vertx.core.Handler<io.vertx.core.AsyncResult<AsyncStorage<Value>>> handler)Loads the configured storage.withCollection(String collection)withPlugin(Class<? extends AsyncStorage> plugin)withPlugin(String plugin)withProperties(io.vertx.core.json.JsonObject properties)
-
Constructor Details
-
StorageLoader
public StorageLoader() -
StorageLoader
Creates a new storage loader- Parameters:
context- the context to use.
-
-
Method Details
-
withDB
- Parameters:
DB- database name to use, if unset defaults to application name.- Returns:
- fluent.
-
withDB
- 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
- Parameters:
valueClass- the class to be stored.- Returns:
- fluent.
-
withProperties
- Parameters:
properties- implementation specific configuration options.- Returns:
- fluent.
-
withPlugin
- Parameters:
plugin- a plugin implementing #AsyncStorage.- Returns:
- fluent.
-
withCollection
- Parameters:
collection- collection name to use, defaults to storables class name.- Returns:
- fluent.
-
withPlugin
- Parameters:
plugin- a plugin to store the given class, must implement #AsyncStorage- Returns:
- fluent.
-
build
Loads the configured storage. Throws an exception if context, class or plugin is unset.- Parameters:
handler- completed when the storage is loaded.
-