Module ultimategdbot.api
Class BooleanConfigEntry
- java.lang.Object
-
- com.github.alex1304.ultimategdbot.api.database.guildconfig.BooleanConfigEntry
-
- All Implemented Interfaces:
ConfigEntry<Boolean>
public final class BooleanConfigEntry extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> reactor.core.publisher.Mono<R>
accept(ConfigEntryVisitor<R> visitor)
Accepts a visitor to visit the concrete type of this config entry.static <D extends GuildConfigData<D>>
ConfigEntryBuilder<D,Boolean>builder(String key)
Creates a builder for this ConfigEntry implementation.String
getDescription()
Gets the description of this entry.String
getDisplayName()
Gets the display name of this entry.discord4j.common.util.Snowflake
getGuildId()
Gets the ID of the guild this config entry is attached to.String
getKey()
Gets the unique key of this entry.reactor.core.publisher.Mono<T>
getValue()
Gets the current value of this entry.boolean
isReadOnly()
Tells whether this entry is read-only.reactor.core.publisher.Mono<Void>
setValue(T newValue)
Sets a new value for this entry.
-
-
-
Method Detail
-
accept
public <R> reactor.core.publisher.Mono<R> accept(ConfigEntryVisitor<R> visitor)
Description copied from interface:ConfigEntry
Accepts a visitor to visit the concrete type of this config entry.- Type Parameters:
R
- the return value type of the visitor- Parameters:
visitor
- the visitor to accept- Returns:
- a Mono emitting the result of the visit
-
builder
public static <D extends GuildConfigData<D>> ConfigEntryBuilder<D,Boolean> builder(String key)
Creates a builder for this ConfigEntry implementation.- Type Parameters:
D
- the implementation type ofGuildConfigData
this entry affects- Parameters:
key
- the unique key identifying the built entry- Returns:
- a new builder
-
getGuildId
public discord4j.common.util.Snowflake getGuildId()
Description copied from interface:ConfigEntry
Gets the ID of the guild this config entry is attached to.- Specified by:
getGuildId
in interfaceConfigEntry<T>
- Returns:
- the guild ID
-
getDisplayName
public String getDisplayName()
Description copied from interface:ConfigEntry
Gets the display name of this entry.- Specified by:
getDisplayName
in interfaceConfigEntry<T>
- Returns:
- the name
-
getDescription
public String getDescription()
Description copied from interface:ConfigEntry
Gets the description of this entry.- Specified by:
getDescription
in interfaceConfigEntry<T>
- Returns:
- the description
-
getKey
public String getKey()
Description copied from interface:ConfigEntry
Gets the unique key of this entry.- Specified by:
getKey
in interfaceConfigEntry<T>
- Returns:
- the key
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:ConfigEntry
Tells whether this entry is read-only. If this method returns true, any call toConfigEntry.setValue(Object)
will result in a Mono emittingReadOnlyConfigEntryException
.- Specified by:
isReadOnly
in interfaceConfigEntry<T>
- Returns:
- true if read-only
-
getValue
public reactor.core.publisher.Mono<T> getValue()
Description copied from interface:ConfigEntry
Gets the current value of this entry.- Specified by:
getValue
in interfaceConfigEntry<T>
- Returns:
- the value
-
setValue
public reactor.core.publisher.Mono<Void> setValue(@Nullable T newValue)
Description copied from interface:ConfigEntry
Sets a new value for this entry. The value is first validated using the validator held by this entry. If validation is successful, the value is set and the returned Mono completes. If the validation fails, the value is not set, andValidationException
is emitted instead.- Specified by:
setValue
in interfaceConfigEntry<T>
- Parameters:
newValue
- the new value for this entry, may be null- Returns:
- a Mono completing when value is validated and set, or
ValidationException
if validation fails
-
-