Record Class ModalDefinition
java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.definitions.interactions.ModalDefinition
- Record Components:
classDescription- theClassDescriptionof the declaring class of themethodDescription()methodDescription- theMethodDescriptionof the method this definition is bound topermissions- aCollectionof permissions for this modaltitle- the title of the modaltextInputs- theTextInputsof this modal
- All Implemented Interfaces:
Definition, CustomIdJDAEntity<Modal>, Invokable, InteractionDefinition
public record ModalDefinition(ClassDescription classDescription, MethodDescription methodDescription, Collection<String> permissions, String title, SequencedCollection<ModalDefinition.TextInputDefinition> textInputs)
extends Record
implements InteractionDefinition, CustomIdJDAEntity<Modal>
Representation of a modal.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresentation of a modal text input defined byTextInputNested classes/interfaces inherited from interface InteractionDefinition
InteractionDefinition.ReplyConfig -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionModalDefinition(ClassDescription classDescription, MethodDescription methodDescription, Collection<String> permissions, String title, SequencedCollection<ModalDefinition.TextInputDefinition> textInputs) Creates an instance of aModalDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ModalDefinitionbuild(MethodBuildContext context) Builds a newModalDefinitionfrom the givenMethodBuildContext.Returns the value of theclassDescriptionrecord 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.Returns the value of themethodDescriptionrecord component.Returns the value of thepermissionsrecord component.Returns the value of thetextInputsrecord component.title()Returns the value of thetitlerecord component.toJDAEntity(CustomId customId) Transforms this definition to anModalwith the given custom id.final StringtoString()Returns a string representation of this record class.with(@Nullable String title, @Nullable List<ModalDefinition.TextInputDefinition> textInputs) Builds a newModalDefinitionwith the given values.Methods inherited from interface InteractionDefinition
definitionId
-
Constructor Details
-
ModalDefinition
public ModalDefinition(ClassDescription classDescription, MethodDescription methodDescription, Collection<String> permissions, String title, SequencedCollection<ModalDefinition.TextInputDefinition> textInputs) Creates an instance of aModalDefinitionrecord class.- Parameters:
classDescription- the value for theclassDescriptionrecord componentmethodDescription- the value for themethodDescriptionrecord componentpermissions- the value for thepermissionsrecord componenttitle- the value for thetitlerecord componenttextInputs- the value for thetextInputsrecord component
-
-
Method Details
-
build
Builds a newModalDefinitionfrom the givenMethodBuildContext.- Returns:
- an
Optionalholding theModalDefinition
-
with
public ModalDefinition with(@Nullable String title, @Nullable List<ModalDefinition.TextInputDefinition> textInputs) Builds a newModalDefinitionwith the given values. -
toJDAEntity
Transforms this definition to anModalwith the given custom id.- Specified by:
toJDAEntityin interfaceCustomIdJDAEntity<Modal>- Parameters:
customId- theCustomIdto use to build this JDA entity- Returns:
- the
Modal - See Also:
-
displayName
Description copied from interface:DefinitionThe human-readable name of this definition.- Specified by:
displayNamein 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). -
classDescription
Returns the value of theclassDescriptionrecord component.- Specified by:
classDescriptionin interfaceInvokable- Returns:
- the value of the
classDescriptionrecord component
-
methodDescription
Returns the value of themethodDescriptionrecord component.- Specified by:
methodDescriptionin interfaceInvokable- Returns:
- the value of the
methodDescriptionrecord component
-
permissions
Returns the value of thepermissionsrecord component.- Specified by:
permissionsin interfaceInteractionDefinition- Returns:
- the value of the
permissionsrecord component
-
title
-
textInputs
Returns the value of thetextInputsrecord component.- Returns:
- the value of the
textInputsrecord component
-