Interface Label
- All Superinterfaces:
Component
,ModalTopLevelComponent
Component that contains a label, an optional description, and a child component.
Labels are used as top-level components inside Modals
,
and cannot be used in Messages.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The maximum length a label description can have.static final int
The maximum length a label can have. -
Method Summary
Modifier and TypeMethodDescriptiongetChild()
The child component contained by this Label.The description of the Label.getLabel()
The label.static Label
of
(String label, String description, LabelChildComponent child) Constructs a newLabel
using the provided label, description and child component.static Label
of
(String label, LabelChildComponent child) Constructs a newLabel
using the provided label and child component.withChild
(LabelChildComponent child) Returns a copy of this Label with the provided child component.withDescription
(String description) Returns a copy of this Label with the provided description.Returns a copy of this Label with the provided label.withUniqueId
(int uniqueId) Creates a new component with the provided numeric ID.Methods inherited from interface net.dv8tion.jda.api.components.Component
getType, getUniqueId, isMessageCompatible, isModalCompatible
-
Field Details
-
LABEL_MAX_LENGTH
static final int LABEL_MAX_LENGTHThe maximum length a label can have. (45)- See Also:
-
DESCRIPTION_MAX_LENGTH
static final int DESCRIPTION_MAX_LENGTHThe maximum length a label description can have. (100)- See Also:
-
-
Method Details
-
of
@Nonnull static Label of(@Nonnull String label, @Nullable String description, @Nonnull LabelChildComponent child) Constructs a newLabel
using the provided label, description and child component.- Parameters:
label
- The label of the Labeldescription
- The description of the Label. May benull
child
- TheLabelChildComponent
that should be contained by the Label- Returns:
- The new
Label
- Throws:
IllegalArgumentException
-- If
label
isnull
, blank, or longer thanLABEL_MAX_LENGTH
- If
description
is notnull
and is blank or longer thanDESCRIPTION_MAX_LENGTH
- If
child
isnull
- If
-
of
Constructs a newLabel
using the provided label and child component.- Parameters:
label
- The label of the Labelchild
- TheLabelChildComponent
that should be contained by the Label- Returns:
- The new
Label
- Throws:
IllegalArgumentException
-- If
label
isnull
, blank, or longer thanLABEL_MAX_LENGTH
- If
child
isnull
- If
-
withLabel
Returns a copy of this Label with the provided label.- Parameters:
label
- The label- Returns:
- The new Label
- Throws:
IllegalArgumentException
- Iflabel
isnull
, blank, or longer thanLABEL_MAX_LENGTH
-
withDescription
Returns a copy of this Label with the provided description.- Parameters:
description
- The description- Returns:
- The new Label
- Throws:
IllegalArgumentException
- Ifdescription
is notnull
and is blank or longer thanDESCRIPTION_MAX_LENGTH
-
withChild
Returns a copy of this Label with the provided child component.- Parameters:
child
- The child component- Returns:
- The new Label
- Throws:
IllegalArgumentException
- Ifchild
isnull
-
getLabel
The label.- Returns:
- The label
-
getDescription
The description of the Label. May benull
.- Returns:
- The description
-
getChild
The child component contained by this Label.- Returns:
- The child component
-
withUniqueId
Description copied from interface:Component
Creates a new component with the provided numeric ID.
If no ID is set, Discord will generate IDs incrementally starting from 1 and will not use existing IDs from the same message/modal.- Specified by:
withUniqueId
in interfaceComponent
- Specified by:
withUniqueId
in interfaceModalTopLevelComponent
- Parameters:
uniqueId
- The new ID; must be higher or equal to 1- Returns:
- The new component
-