Class ContainerImpl
java.lang.Object
net.dv8tion.jda.internal.components.AbstractComponentImpl
net.dv8tion.jda.internal.components.container.ContainerImpl
- All Implemented Interfaces:
IDisableable
,Component
,Container
,IComponentUnion
,MessageTopLevelComponent
,MessageTopLevelComponentUnion
,IReplaceable
,SerializableData
public class ContainerImpl
extends AbstractComponentImpl
implements Container, MessageTopLevelComponentUnion
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type
-
Constructor Summary
ConstructorsConstructorDescriptionContainerImpl
(int uniqueId, Collection<ContainerChildComponentUnion> components, boolean spoiler, Integer accentColor) ContainerImpl
(DataObject data) -
Method Summary
Modifier and TypeMethodDescriptionboolean
The raw RGB color value for the stripe/border on the side of the container.Returns an immutable list with the components contained by this container.getType()
The type of component.int
The unique, numeric identifier of this component.int
hashCode()
boolean
Whether this container is hidden until the user clicks on it.static Container
of
(Collection<? extends ContainerChildComponent> components) replace
(ComponentReplacer replacer) Replaces and/or removes children components using the providedComponentReplacer
, and construct a new component from the result.toData()
SerializedDataObject
for this object.toString()
withAccentColor
(Integer accentColor) Creates a newContainer
with the specified accent color, which appears on the side.withSpoiler
(boolean spoiler) Creates a newContainer
with the specified spoiler status.withUniqueId
(int uniqueId) Creates a new component with the provided numeric ID.Methods inherited from class net.dv8tion.jda.internal.components.AbstractComponentImpl
asActionRow, asButton, asContainer, asEntitySelectMenu, asFileDisplay, asMediaGallery, asSection, asSeparator, asStringSelectMenu, asTextDisplay, asTextInput, asThumbnail
Methods inherited from interface net.dv8tion.jda.api.components.container.Container
asDisabled, asEnabled, getAccentColor, isDisabled, isEnabled, isMessageCompatible, isModalCompatible, withAccentColor, withDisabled
Methods inherited from interface net.dv8tion.jda.api.components.IComponentUnion
isUnknownComponent
Methods inherited from interface net.dv8tion.jda.api.components.MessageTopLevelComponentUnion
asActionRow, asContainer, asFileDisplay, asMediaGallery, asSection, asSeparator, asTextDisplay
-
Constructor Details
-
ContainerImpl
-
ContainerImpl
public ContainerImpl(int uniqueId, Collection<ContainerChildComponentUnion> components, boolean spoiler, Integer accentColor)
-
-
Method Details
-
of
-
getType
Description copied from interface:Component
The type of component.- Specified by:
getType
in interfaceComponent
- Returns:
Component.Type
-
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 interfaceContainer
- Specified by:
withUniqueId
in interfaceIComponentUnion
- Specified by:
withUniqueId
in interfaceIDisableable
- Specified by:
withUniqueId
in interfaceMessageTopLevelComponent
- Specified by:
withUniqueId
in interfaceMessageTopLevelComponentUnion
- Parameters:
uniqueId
- The new ID; must be higher or equal to 1- Returns:
- The new component
-
withSpoiler
Description copied from interface:Container
Creates a newContainer
with the specified spoiler status.
Spoilers are hidden until the user clicks on it.- Specified by:
withSpoiler
in interfaceContainer
- Parameters:
spoiler
- The new spoiler status- Returns:
- The new
Container
-
withAccentColor
Description copied from interface:Container
Creates a newContainer
with the specified accent color, which appears on the side.- Specified by:
withAccentColor
in interfaceContainer
- Parameters:
accentColor
- The new accent color, ornull
to remove it- Returns:
- The new
Container
-
getUniqueId
public int getUniqueId()Description copied from interface:Component
The unique, numeric identifier of this component.
Can be set manually or automatically assigned by Discord (starting from1
). If it has not been assigned yet, this will return-1
.Note: Older messages may return
0
.- Specified by:
getUniqueId
in interfaceComponent
- Returns:
- The unique identifier of this component, or
-1
if not assigned yet, or0
on older messages
-
replace
Description copied from interface:IReplaceable
Replaces and/or removes children components using the providedComponentReplacer
, and construct a new component from the result.- Specified by:
replace
in interfaceContainer
- Specified by:
replace
in interfaceIReplaceable
- Parameters:
replacer
- TheComponentReplacer
to apply- Returns:
- The new, updated component
- See Also:
-
getComponents
Description copied from interface:Container
Returns an immutable list with the components contained by this container.- Specified by:
getComponents
in interfaceContainer
- Returns:
List
ofContainerChildComponentUnion
in this container
-
getAccentColorRaw
Description copied from interface:Container
The raw RGB color value for the stripe/border on the side of the container.
If no accent color has been set, this will return null.- Specified by:
getAccentColorRaw
in interfaceContainer
- Returns:
- The raw RGB color value or
null
.
-
isSpoiler
public boolean isSpoiler()Description copied from interface:Container
Whether this container is hidden until the user clicks on it. -
toData
Description copied from interface:SerializableData
SerializedDataObject
for this object.- Specified by:
toData
in interfaceSerializableData
- Returns:
DataObject
-
equals
-
hashCode
public int hashCode() -
toString
-