Class ActionRow
- java.lang.Object
-
- net.dv8tion.jda.api.interactions.components.ActionRow
-
- All Implemented Interfaces:
java.lang.Iterable<Component>
,ComponentLayout
,SerializableData
public class ActionRow extends java.lang.Object implements ComponentLayout, java.lang.Iterable<Component>
One row of interactive message components.- See Also:
Component
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.interactions.components.ComponentLayout
ComponentLayout.Type
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ActionRow
fromData(DataObject data)
Load ActionRow from serialized representation.java.util.List<Button>
getButtons()
Immutable list of buttons in this ActionRow.java.util.List<Component>
getComponents()
Mutable list of components in this ActionRow.ComponentLayout.Type
getType()
TheComponentLayout.Type
of layoutjava.util.Iterator<Component>
iterator()
static ActionRow
of(java.util.Collection<? extends Component> components)
Create one row of interactive messagecomponents
.static ActionRow
of(Component... components)
Create one row of interactive messagecomponents
.DataObject
toData()
SerializedDataObject
for this object.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.dv8tion.jda.api.interactions.components.ComponentLayout
isEmpty, isValid, updateComponent
-
-
-
-
Method Detail
-
fromData
@Nonnull public static ActionRow fromData(@Nonnull DataObject data)
Load ActionRow from serialized representation.
Inverse oftoData()
.- Parameters:
data
- Serialized version of an action row- Returns:
- ActionRow instance
- Throws:
ParsingException
- If the provided data is not a valid action rowjava.lang.IllegalArgumentException
- If the data is null or the type is not 1
-
of
@Nonnull public static ActionRow of(@Nonnull java.util.Collection<? extends Component> components)
Create one row of interactive messagecomponents
.
You cannot currently mix different types of components and each type has its own maximum defined byComponent.Type.getMaxPerRow()
.- Parameters:
components
- The components for this action row- Returns:
- The action row
- Throws:
java.lang.IllegalArgumentException
- If anything is null, empty, or an invalid number of components are provided
-
of
@Nonnull public static ActionRow of(@Nonnull Component... components)
Create one row of interactive messagecomponents
.
You cannot currently mix different types of components and each type has its own maximum defined byComponent.Type.getMaxPerRow()
.- Parameters:
components
- The components for this action row- Returns:
- The action row
- Throws:
java.lang.IllegalArgumentException
- If anything is null, empty, or an invalid number of components are provided
-
getComponents
@Nonnull public java.util.List<Component> getComponents()
Mutable list of components in this ActionRow.
ActionRows should not be empty and are limited to 5 buttons.- Specified by:
getComponents
in interfaceComponentLayout
- Returns:
- The list of components
-
getButtons
@Nonnull public java.util.List<Button> getButtons()
Immutable list of buttons in this ActionRow.- Specified by:
getButtons
in interfaceComponentLayout
- Returns:
- Immutable list of buttons
-
getType
@Nonnull public ComponentLayout.Type getType()
Description copied from interface:ComponentLayout
TheComponentLayout.Type
of layout- Specified by:
getType
in interfaceComponentLayout
- Returns:
- The layout
ComponentLayout.Type
orComponentLayout.Type.UNKNOWN
-
toData
@Nonnull public DataObject toData()
Description copied from interface:SerializableData
SerializedDataObject
for this object.- Specified by:
toData
in interfaceSerializableData
- Returns:
DataObject
-
-