Record Class OptionDataDefinition
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.command.OptionDataDefinition
- Record Components:
type
- theClass
type of the parameteroptional
- whether this parameter is optionalautoComplete
- whether this parameter supports autocompletedefaultValue
- the default value of this parameter ornull
name
- the name of the parameterdescription
- the description of the parameterchoices
- aSequencedCollection
of possibleCommand.Choice
s for this parameterconstraints
- aCollection
ofOptionDataDefinition.ConstraintDefinition
s of this parameter
- All Implemented Interfaces:
Definition
,JDAEntity<OptionData>
public record OptionDataDefinition(@NotNull Class<?> type, boolean optional, boolean autoComplete, @Nullable String defaultValue, @NotNull String name, @NotNull String description, @NotNull SequencedCollection<Command.Choice> choices, @NotNull Collection<OptionDataDefinition.ConstraintDefinition> constraints)
extends Record
implements Definition, JDAEntity<OptionData>
Representation of a slash command parameter.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Representation of a parameter constraint defined by a constraint annotation. -
Constructor Summary
ConstructorDescriptionOptionDataDefinition
(@NotNull Class<?> type, boolean optional, boolean autoComplete, @Nullable String defaultValue, @NotNull String name, @NotNull String description, @NotNull SequencedCollection<Command.Choice> choices, @NotNull Collection<OptionDataDefinition.ConstraintDefinition> constraints) Creates an instance of aOptionDataDefinition
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the value of theautoComplete
record component.static @NotNull OptionDataDefinition
build
(@NotNull ParameterDescription parameter, boolean autoComplete, @NotNull com.github.kaktushose.jda.commands.dispatching.validation.internal.Validators validatorRegistry) Builds a newOptionDataDefinition
.@NotNull SequencedCollection
<Command.Choice> choices()
Returns the value of thechoices
record component.Returns the value of theconstraints
record component.@Nullable String
Returns the value of thedefaultValue
record component.@NotNull String
Returns the value of thedescription
record component.@NotNull String
The human-readable name of this definition.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.@NotNull String
name()
Returns the value of thename
record component.boolean
optional()
Returns the value of theoptional
record component.@NotNull OptionData
Transforms this definition intoOptionData
.final String
toString()
Returns a string representation of this record class.@NotNull Class
<?> type()
Returns the value of thetype
record component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.github.kaktushose.jda.commands.definitions.Definition
definitionId
-
Constructor Details
-
OptionDataDefinition
public OptionDataDefinition(@NotNull @NotNull Class<?> type, boolean optional, boolean autoComplete, @Nullable @Nullable String defaultValue, @NotNull @NotNull String name, @NotNull @NotNull String description, @NotNull @NotNull SequencedCollection<Command.Choice> choices, @NotNull @NotNull Collection<OptionDataDefinition.ConstraintDefinition> constraints) Creates an instance of aOptionDataDefinition
record class.- Parameters:
type
- the value for thetype
record componentoptional
- the value for theoptional
record componentautoComplete
- the value for theautoComplete
record componentdefaultValue
- the value for thedefaultValue
record componentname
- the value for thename
record componentdescription
- the value for thedescription
record componentchoices
- the value for thechoices
record componentconstraints
- the value for theconstraints
record component
-
-
Method Details
-
build
@NotNull public static @NotNull OptionDataDefinition build(@NotNull @NotNull ParameterDescription parameter, boolean autoComplete, @NotNull @NotNull com.github.kaktushose.jda.commands.dispatching.validation.internal.Validators validatorRegistry) Builds a newOptionDataDefinition
.- Parameters:
parameter
- theParameterDescription
to build theOptionDataDefinition
fromautoComplete
- whether theParameterDescription
should support autocompletevalidatorRegistry
- the correspondingValidators
- Returns:
- the
OptionDataDefinition
-
displayName
Description copied from interface:Definition
The human-readable name of this definition.- Specified by:
displayName
in interfaceDefinition
-
toJDAEntity
Transforms this definition intoOptionData
.- Specified by:
toJDAEntity
in interfaceJDAEntity<OptionData>
- Returns:
- the
OptionData
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with thecompare
method from their corresponding wrapper classes. -
type
-
optional
-
autoComplete
public boolean autoComplete()Returns the value of theautoComplete
record component.- Returns:
- the value of the
autoComplete
record component
-
defaultValue
Returns the value of thedefaultValue
record component.- Returns:
- the value of the
defaultValue
record component
-
name
-
description
Returns the value of thedescription
record component.- Returns:
- the value of the
description
record component
-
choices
-
constraints
Returns the value of theconstraints
record component.- Returns:
- the value of the
constraints
record component
-