Record Class OptionDataDefinition.ConstraintDefinition
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.command.OptionDataDefinition.ConstraintDefinition
- Record Components:
validator
- the correspondingValidator
message
- the message to display if the constraint failsannotation
- 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 Summary
ConstructorDescriptionConstraintDefinition
(Validator validator, String message, Object annotation) Creates an instance of aConstraintDefinition
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theannotation
record component.build
(@NotNull Validator validator, @NotNull Annotation annotation) Builds a newOptionDataDefinition.ConstraintDefinition
.@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.message()
Returns the value of themessage
record component.final String
toString()
Returns a string representation of this record class.Returns the value of thevalidator
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
-
ConstraintDefinition
Creates an instance of aConstraintDefinition
record class.- Parameters:
validator
- the value for thevalidator
record componentmessage
- the value for themessage
record componentannotation
- the value for theannotation
record component
-
-
Method Details
-
build
public static OptionDataDefinition.ConstraintDefinition build(@NotNull @NotNull Validator validator, @NotNull @NotNull Annotation annotation) Builds a newOptionDataDefinition.ConstraintDefinition
.- Parameters:
validator
- the correspondingValidator
annotation
- the corresponding annotation object
-
displayName
Description copied from interface:Definition
The human-readable name of this definition.- Specified by:
displayName
in interfaceDefinition
-
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
validator
-
message
-
annotation
Returns the value of theannotation
record component.- Returns:
- the value of the
annotation
record component
-