Module ultimategdbot.api
Interface GuildConfigDao<D extends GuildConfigData<D>>
-
- Type Parameters:
D
- the type of object storing the configuration for a guild
public interface GuildConfigDao<D extends GuildConfigData<D>>
Generic DAO to retrieve configuration for a guild.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
create(long guildId)
Creates new configuration data for this guild with default values.Optional<D>
get(long guildId)
Retrieves the data for a particular guild, if present.default D
getOrCreate(long guildId)
Retrieves the data for a particular guild.void
reset(long guildId)
Resets data for this guild.default D
resetAndGet(long guildId)
Resets the data for a particular guild, then returns the data after reset.void
update(D data)
Updates the data for a certain guild.
-
-
-
Method Detail
-
create
void create(long guildId)
Creates new configuration data for this guild with default values.- Parameters:
guildId
- the ID of the guild
-
reset
void reset(long guildId)
Resets data for this guild.- Parameters:
guildId
- the ID of the guild
-
update
void update(D data)
Updates the data for a certain guild.- Parameters:
data
- the data for a guild
-
get
Optional<D> get(long guildId)
Retrieves the data for a particular guild, if present.- Parameters:
guildId
- the ID of the guild- Returns:
- the data for that guild, if present
-
getOrCreate
default D getOrCreate(long guildId)
Retrieves the data for a particular guild. If not present, empty settings are created and returned.- Parameters:
guildId
- the ID of the guild- Returns:
- the data for that guild
-
resetAndGet
default D resetAndGet(long guildId)
Resets the data for a particular guild, then returns the data after reset.- Parameters:
guildId
- the ID of the guild- Returns:
- the data for that guild after reset
-
-