Record Class OptionDataDefinition.ConstraintDefinition

java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.command.OptionDataDefinition.ConstraintDefinition
Record Components:
validator - the corresponding Validator
message - the message to display if the constraint fails
annotation - the corresponding annotation object
All Implemented Interfaces:
Definition
Enclosing class:
OptionDataDefinition

public static record OptionDataDefinition.ConstraintDefinition(Validator validator, String message, Object annotation) extends Record implements Definition
Representation of a parameter constraint defined by a constraint annotation.
  • Constructor Details

    • ConstraintDefinition

      public ConstraintDefinition(Validator validator, String message, Object annotation)
      Creates an instance of a ConstraintDefinition record class.
      Parameters:
      validator - the value for the validator record component
      message - the value for the message record component
      annotation - the value for the annotation record component
  • Method Details

    • build

      public static OptionDataDefinition.ConstraintDefinition build(@NotNull @NotNull Validator validator, @NotNull @NotNull Annotation annotation)
      Parameters:
      validator - the corresponding Validator
      annotation - the corresponding annotation object
    • displayName

      @NotNull public @NotNull String displayName()
      Description copied from interface: Definition
      The human-readable name of this definition.
      Specified by:
      displayName in interface Definition
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • validator

      public Validator validator()
      Returns the value of the validator record component.
      Returns:
      the value of the validator record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • annotation

      public Object annotation()
      Returns the value of the annotation record component.
      Returns:
      the value of the annotation record component