Package xyz.srnyx.annoyingapi.storage
Class StorageConfig
- java.lang.Object
-
- xyz.srnyx.annoyingapi.storage.StorageConfig
-
public class StorageConfig extends java.lang.ObjectThestorage.ymlconfiguration file parser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classStorageConfig.CacheOptions for the data cache (stored differently per method)classStorageConfig.RemoteConnectionThe remote connection details/propertiesstatic classStorageConfig.SaveOnValid values forstorage.yml'scache.save-onoption
-
Field Summary
Fields Modifier and Type Field Description @NotNull StorageConfig.CachecacheThedata cacheoptions@NotNull AnnoyingFile<?>fileThestorage configuration file@NotNull StorageMethodmethodThestorage method@NotNull java.lang.StringmigrationLogPrefixFriendly name when migrating between methods for logging
Format:FILE_PATH (METHOD)@Nullable StorageConfig.RemoteConnectionremoteConnectionTheremote connectiondetails/properties
-
Constructor Summary
Constructors Constructor Description StorageConfig(@NotNull AnnoyingFile<?> file)Construct a newStorageConfiginstance to parse a storage configuration file
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull java.sql.ConnectioncreateConnection()Create a newConnectionto the configured database
-
-
-
Field Detail
-
file
@NotNull public final @NotNull AnnoyingFile<?> file
Thestorage configuration file
-
method
@NotNull public final @NotNull StorageMethod method
Thestorage method
-
cache
@NotNull public final @NotNull StorageConfig.Cache cache
Thedata cacheoptions
-
remoteConnection
@Nullable public final @Nullable StorageConfig.RemoteConnection remoteConnection
Theremote connectiondetails/properties
-
migrationLogPrefix
@NotNull public final @NotNull java.lang.String migrationLogPrefix
Friendly name when migrating between methods for logging
Format:FILE_PATH (METHOD)
-
-
Constructor Detail
-
StorageConfig
public StorageConfig(@NotNull @NotNull AnnoyingFile<?> file)Construct a newStorageConfiginstance to parse a storage configuration file- Parameters:
file-file
-
-
Method Detail
-
createConnection
@NotNull public @NotNull java.sql.Connection createConnection() throws ConnectionExceptionCreate a newConnectionto the configured database- Returns:
- a new
Connectionto the database - Throws:
ConnectionException- if the connection to the database fails for any reason
-
-