Record Class OptionDataDefinition

java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.command.OptionDataDefinition
Record Components:
type - the Class type of the parameter
optional - whether this parameter is optional
autoComplete - whether this parameter supports autocomplete
defaultValue - the default value of this parameter or null
name - the name of the parameter
description - the description of the parameter
choices - a SequencedCollection of possible Command.Choices for this parameter
constraints - a Collection of OptionDataDefinition.ConstraintDefinitions 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.
  • 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 a OptionDataDefinition record class.
      Parameters:
      type - the value for the type record component
      optional - the value for the optional record component
      autoComplete - the value for the autoComplete record component
      defaultValue - the value for the defaultValue 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

      @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 new OptionDataDefinition.
      Parameters:
      parameter - the ParameterDescription to build the OptionDataDefinition from
      autoComplete - whether the ParameterDescription should support autocomplete
      validatorRegistry - the corresponding Validators
      Returns:
      the OptionDataDefinition
    • displayName

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

      @NotNull public @NotNull OptionData toJDAEntity()
      Transforms this definition into OptionData.
      Specified by:
      toJDAEntity in interface JDAEntity<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.
    • type

      @NotNull public @NotNull Class<?> type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • optional

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

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

      @Nullable public @Nullable String defaultValue()
      Returns the value of the defaultValue record component.
      Returns:
      the value of the defaultValue record component
    • name

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

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

      @NotNull public @NotNull SequencedCollection<Command.Choice> choices()
      Returns the value of the choices record component.
      Returns:
      the value of the choices record component
    • constraints

      @NotNull public @NotNull Collection<OptionDataDefinition.ConstraintDefinition> constraints()
      Returns the value of the constraints record component.
      Returns:
      the value of the constraints record component