Record Class OptionDataDefinition

java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.definitions.interactions.command.OptionDataDefinition
Record Components:
declaredType - the Class declaredType of the command option
resolvedType - the type after wrapping primitive types and unwrapping Optional
optionType - the OptionType of the command option
optional - whether this command option is optional
autoComplete - he AutoCompleteDefinition for this option or null if no auto complete was defined
name - the name of the command option
description - the description of the command option
choices - a SequencedCollection of possible Command.Choices for this command option
constraints - a Collection of OptionDataDefinition.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.
  • 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 a OptionDataDefinition record class.
      Parameters:
      declaredType - the value for the declaredType record component
      resolvedType - the value for the resolvedType record component
      optionType - the value for the optionType record component
      optional - the value for the optional record component
      autoComplete - the value for the autoComplete record component
      name - the value for the name record component
      description - the value for the description record component
      choices - the value for the choices record component
      constraints - the value for the constraints record component
  • Method Details

    • build

      public static OptionDataDefinition build(ParameterDescription parameter, ClassDescription classDescription, @Nullable AutoCompleteDefinition autoComplete, MessageResolver messageResolver, Validators validators)
      Builds a new OptionDataDefinition.
      Parameters:
      parameter - the ParameterDescription to build the OptionDataDefinition from
      classDescription - the ClassDescription of the method where the parameter is defined
      autoComplete - the AutoCompleteDefinition for this option or null if no auto complete was defined
      messageResolver - the MessageResolver instance to use
      validators - the corresponding Validators
      Returns:
      the OptionDataDefinition
    • displayName

      public String displayName()
      Description copied from interface: Definition
      The human-readable name of this definition.
      Specified by:
      displayName in interface Definition
    • toJDAEntity

      public net.dv8tion.jda.api.interactions.commands.build.OptionData toJDAEntity()
      Transforms this definition into OptionData.
      Specified by:
      toJDAEntity in interface JDAEntity<net.dv8tion.jda.api.interactions.commands.build.OptionData>
      Returns:
      the OptionData
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • declaredType

      public Class<?> declaredType()
      Returns the value of the declaredType record component.
      Returns:
      the value of the declaredType record component
    • resolvedType

      public Class<?> resolvedType()
      Returns the value of the resolvedType record component.
      Returns:
      the value of the resolvedType record component
    • optionType

      public net.dv8tion.jda.api.interactions.commands.OptionType optionType()
      Returns the value of the optionType record component.
      Returns:
      the value of the optionType record component
    • optional

      public boolean optional()
      Returns the value of the optional record component.
      Returns:
      the value of the optional record component
    • autoComplete

      public @Nullable AutoCompleteDefinition autoComplete()
      Returns the value of the autoComplete record component.
      Returns:
      the value of the autoComplete record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • choices

      public SequencedCollection<net.dv8tion.jda.api.interactions.commands.Command.Choice> choices()
      Returns the value of the choices record component.
      Returns:
      the value of the choices record component
    • constraints

      Returns the value of the constraints record component.
      Returns:
      the value of the constraints record component