Module ultimategdbot.api
Class StringConfigEntry
- java.lang.Object
-
- com.github.alex1304.ultimategdbot.api.database.guildconfig.StringConfigEntry
-
- All Implemented Interfaces:
ConfigEntry<String>
public final class StringConfigEntry 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,String>builder(String key)Creates a builder for this ConfigEntry implementation.StringgetDescription()Gets the description of this entry.StringgetDisplayName()Gets the display name of this entry.discord4j.common.util.SnowflakegetGuildId()Gets the ID of the guild this config entry is attached to.StringgetKey()Gets the unique key of this entry.reactor.core.publisher.Mono<T>getValue()Gets the current value of this entry.booleanisReadOnly()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:ConfigEntryAccepts 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,String> builder(String key)
Creates a builder for this ConfigEntry implementation.- Type Parameters:
D- the implementation type ofGuildConfigDatathis 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:ConfigEntryGets the ID of the guild this config entry is attached to.- Specified by:
getGuildIdin interfaceConfigEntry<T>- Returns:
- the guild ID
-
getDisplayName
public String getDisplayName()
Description copied from interface:ConfigEntryGets the display name of this entry.- Specified by:
getDisplayNamein interfaceConfigEntry<T>- Returns:
- the name
-
getDescription
public String getDescription()
Description copied from interface:ConfigEntryGets the description of this entry.- Specified by:
getDescriptionin interfaceConfigEntry<T>- Returns:
- the description
-
getKey
public String getKey()
Description copied from interface:ConfigEntryGets the unique key of this entry.- Specified by:
getKeyin interfaceConfigEntry<T>- Returns:
- the key
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:ConfigEntryTells whether this entry is read-only. If this method returns true, any call toConfigEntry.setValue(Object)will result in a Mono emittingReadOnlyConfigEntryException.- Specified by:
isReadOnlyin interfaceConfigEntry<T>- Returns:
- true if read-only
-
getValue
public reactor.core.publisher.Mono<T> getValue()
Description copied from interface:ConfigEntryGets the current value of this entry.- Specified by:
getValuein interfaceConfigEntry<T>- Returns:
- the value
-
setValue
public reactor.core.publisher.Mono<Void> setValue(@Nullable T newValue)
Description copied from interface:ConfigEntrySets 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, andValidationExceptionis emitted instead.- Specified by:
setValuein interfaceConfigEntry<T>- Parameters:
newValue- the new value for this entry, may be null- Returns:
- a Mono completing when value is validated and set, or
ValidationExceptionif validation fails
-
-