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 ActionRowfromData(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.TypegetType()TheComponentLayout.Typeof layoutjava.util.Iterator<Component>iterator()static ActionRowof(java.util.Collection<? extends Component> components)Create one row of interactive messagecomponents.static ActionRowof(Component... components)Create one row of interactive messagecomponents.DataObjecttoData()SerializedDataObjectfor 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:
getComponentsin interfaceComponentLayout- Returns:
- The list of components
-
getButtons
@Nonnull public java.util.List<Button> getButtons()
Immutable list of buttons in this ActionRow.- Specified by:
getButtonsin interfaceComponentLayout- Returns:
- Immutable list of buttons
-
getType
@Nonnull public ComponentLayout.Type getType()
Description copied from interface:ComponentLayoutTheComponentLayout.Typeof layout- Specified by:
getTypein interfaceComponentLayout- Returns:
- The layout
ComponentLayout.TypeorComponentLayout.Type.UNKNOWN
-
toData
@Nonnull public DataObject toData()
Description copied from interface:SerializableDataSerializedDataObjectfor this object.- Specified by:
toDatain interfaceSerializableData- Returns:
DataObject
-
-