Record Class OptionDataDefinition
java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.definitions.interactions.command.OptionDataDefinition
- Record Components:
declaredType- theClassdeclaredType of the command optionresolvedType- the type after wrapping primitive types and unwrappingOptionaloptionType- theOptionTypeof the command optionoptional- whether this command option is optionalautoComplete- heAutoCompleteDefinitionfor this option ornullif no auto complete was definedname- the name of the command optiondescription- the description of the command optionchoices- aSequencedCollectionof possibleCommand.Choices for this command optionconstraints- aCollectionofOptionDataDefinition.ConstraintDefinitions of this command option
- All Implemented Interfaces:
Definition, JDAEntity<net.dv8tion.jda.api.interactions.commands.build.OptionData>
public record OptionDataDefinition(Class<?> declaredType, Class<?> resolvedType, net.dv8tion.jda.api.interactions.commands.OptionType optionType, boolean optional, @Nullable AutoCompleteDefinition autoComplete, String name, String description, SequencedCollection<net.dv8tion.jda.api.interactions.commands.Command.Choice> choices, Collection<OptionDataDefinition.ConstraintDefinition> constraints)
extends Record
implements Definition, JDAEntity<net.dv8tion.jda.api.interactions.commands.build.OptionData>
Representation of a slash command option.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresentation of a parameter constraint defined by a constraint annotation. -
Constructor Summary
ConstructorsConstructorDescriptionOptionDataDefinition(Class<?> declaredType, Class<?> resolvedType, net.dv8tion.jda.api.interactions.commands.OptionType optionType, boolean optional, @Nullable AutoCompleteDefinition autoComplete, String name, String description, SequencedCollection<net.dv8tion.jda.api.interactions.commands.Command.Choice> choices, Collection<OptionDataDefinition.ConstraintDefinition> constraints) Creates an instance of aOptionDataDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable AutoCompleteDefinitionReturns the value of theautoCompleterecord component.static OptionDataDefinitionbuild(ParameterDescription parameter, ClassDescription classDescription, @Nullable AutoCompleteDefinition autoComplete, MessageResolver messageResolver, Validators validators) Builds a newOptionDataDefinition.SequencedCollection<net.dv8tion.jda.api.interactions.commands.Command.Choice> choices()Returns the value of thechoicesrecord component.Returns the value of theconstraintsrecord component.Class<?> Returns the value of thedeclaredTyperecord component.Returns the value of thedescriptionrecord component.The human-readable name of this definition.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.booleanoptional()Returns the value of theoptionalrecord component.net.dv8tion.jda.api.interactions.commands.OptionTypeReturns the value of theoptionTyperecord component.Class<?> Returns the value of theresolvedTyperecord component.net.dv8tion.jda.api.interactions.commands.build.OptionDataTransforms this definition intoOptionData.final StringtoString()Returns a string representation of this record class.Methods inherited from interface Definition
definitionId
-
Constructor Details
-
OptionDataDefinition
public OptionDataDefinition(Class<?> declaredType, Class<?> resolvedType, net.dv8tion.jda.api.interactions.commands.OptionType optionType, boolean optional, @Nullable AutoCompleteDefinition autoComplete, String name, String description, SequencedCollection<net.dv8tion.jda.api.interactions.commands.Command.Choice> choices, Collection<OptionDataDefinition.ConstraintDefinition> constraints) Creates an instance of aOptionDataDefinitionrecord class.- Parameters:
declaredType- the value for thedeclaredTyperecord componentresolvedType- the value for theresolvedTyperecord componentoptionType- the value for theoptionTyperecord componentoptional- the value for theoptionalrecord componentautoComplete- the value for theautoCompleterecord componentname- the value for thenamerecord componentdescription- the value for thedescriptionrecord componentchoices- the value for thechoicesrecord componentconstraints- the value for theconstraintsrecord component
-
-
Method Details
-
build
public static OptionDataDefinition build(ParameterDescription parameter, ClassDescription classDescription, @Nullable AutoCompleteDefinition autoComplete, MessageResolver messageResolver, Validators validators) Builds a newOptionDataDefinition.- Parameters:
parameter- theParameterDescriptionto build theOptionDataDefinitionfromclassDescription- theClassDescriptionof the method where the parameter is definedautoComplete- theAutoCompleteDefinitionfor this option ornullif no auto complete was definedmessageResolver- theMessageResolverinstance to usevalidators- the correspondingValidators- Returns:
- the
OptionDataDefinition
-
displayName
Description copied from interface:DefinitionThe human-readable name of this definition.- Specified by:
displayNamein interfaceDefinition
-
toJDAEntity
public net.dv8tion.jda.api.interactions.commands.build.OptionData toJDAEntity()Transforms this definition intoOptionData.- Specified by:
toJDAEntityin interfaceJDAEntity<net.dv8tion.jda.api.interactions.commands.build.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 thecomparemethod from their corresponding wrapper classes. -
declaredType
Returns the value of thedeclaredTyperecord component.- Returns:
- the value of the
declaredTyperecord component
-
resolvedType
Returns the value of theresolvedTyperecord component.- Returns:
- the value of the
resolvedTyperecord component
-
optionType
public net.dv8tion.jda.api.interactions.commands.OptionType optionType()Returns the value of theoptionTyperecord component.- Returns:
- the value of the
optionTyperecord component
-
optional
-
autoComplete
Returns the value of theautoCompleterecord component.- Returns:
- the value of the
autoCompleterecord component
-
name
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
choices
-
constraints
Returns the value of theconstraintsrecord component.- Returns:
- the value of the
constraintsrecord component
-