java.lang.Object
net.foxgenesis.database.AbstractDatabase
net.foxgenesis.watame.sql.WatameBotDatabase
- All Implemented Interfaces:
AutoCloseable,IPropertyProvider<String,,net.dv8tion.jda.api.entities.Guild, IGuildPropertyMapping> IGuildPropertyProvider,IGuildDataProvider
public class WatameBotDatabase
extends AbstractDatabase
implements IGuildDataProvider, IGuildPropertyProvider
-
Nested Class Summary
Nested classes/interfaces inherited from class net.foxgenesis.database.AbstractDatabase
AbstractDatabase.SQLConsumer<U>, AbstractDatabase.SQLFunction<U,V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGuild(long id) Register a guild to be loaded during data retrieval.voidclose()@Nullable IGuildDatagetDataForGuild(@NotNull net.dv8tion.jda.api.entities.Guild guild) NEED_JAVADOCgetProperty(@NotNull String key) Get a property field associated with a specified key.booleanisPropertyPresent(@NotNull String key) Check if the property associated with the specified key has already been constructed.keySet()Get a set of all registered keys this provider has constructed.protected voidonReady()NEED_JAVADOCvoidremoveGuild(long id) Remove a guild from the data manager.Methods inherited from class net.foxgenesis.database.AbstractDatabase
getName, getRawStatement, hasStatementID, isReady, mapCallable, mapStatement, openConnection, prepareCallable, prepareStatementMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.foxgenesis.watame.sql.IGuildDataProvider
isReady
-
Constructor Details
-
WatameBotDatabase
public WatameBotDatabase()
-
-
Method Details
-
addGuild
public void addGuild(long id) Register a guild to be loaded during data retrieval.NOTE: This contains a
ForkJoinPool.ManagedBlocker!- Parameters:
id- - guild ID to be removed- Throws:
IllegalArgumentException- ifidis 0- See Also:
-
removeGuild
public void removeGuild(long id) Remove a guild from the data manager.- Parameters:
id- - guild ID to be removed- Throws:
IllegalArgumentException- ifidis 0- See Also:
-
getDataForGuild
@Nullable public @Nullable IGuildData getDataForGuild(@NotNull @NotNull net.dv8tion.jda.api.entities.Guild guild) Description copied from interface:IGuildDataProviderNEED_JAVADOC- Specified by:
getDataForGuildin interfaceIGuildDataProvider- Returns:
-
getProperty
Description copied from interface:IPropertyProviderGet a property field associated with a specified key.- Specified by:
getPropertyin interfaceIPropertyProvider<String,net.dv8tion.jda.api.entities.Guild, IGuildPropertyMapping> - Parameters:
key- - the property's key- Returns:
- Returns an
ImmutablePropertypointing to the specified key
-
isPropertyPresent
Description copied from interface:IPropertyProviderCheck if the property associated with the specified key has already been constructed.- Specified by:
isPropertyPresentin interfaceIPropertyProvider<String,net.dv8tion.jda.api.entities.Guild, IGuildPropertyMapping> - Parameters:
key- - the property's key- Returns:
- Returns
trueif the property's key has already been registered/constructed.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
onReady
protected void onReady()Description copied from class:AbstractDatabaseNEED_JAVADOC- Specified by:
onReadyin classAbstractDatabase
-
keySet
Description copied from interface:IPropertyProviderGet a set of all registered keys this provider has constructed.- Specified by:
keySetin interfaceIPropertyProvider<String,net.dv8tion.jda.api.entities.Guild, IGuildPropertyMapping> - Returns:
- Returns a
SetofIPropertyProvider
-