Interface SectionContentComponentUnion
- All Superinterfaces:
Component,IComponentUnion,SectionContentComponent
Represents a union of
SectionContentComponents that can be one of:
TextDisplayUnknownComponent, detectable viaIComponentUnion.isUnknownComponent()
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type -
Method Summary
Modifier and TypeMethodDescriptionCasts this union to aTextDisplay.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, isModalCompatibleMethods inherited from interface net.dv8tion.jda.api.components.IComponentUnion
isUnknownComponent
-
Method Details
-
asTextDisplay
Casts this union to aTextDisplay. This method exists for developer discoverability.Note: This is effectively equivalent to using the cast operator:
You can use//These are the same! TextDisplay textDisplay = union.asTextDisplay(); TextDisplay textDisplay2 = (TextDisplay) union;Component.getType()to see if the component is of typeComponent.Type.TEXT_DISPLAYto validate whether you can call this method in addition to normal instanceof checks:component instanceof TextDisplay- Returns:
- The component as a
TextDisplay - Throws:
IllegalStateException- If the component represented by this union is not actually aTextDisplay.
-
withUniqueId
Description copied from interface:ComponentCreates 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:
withUniqueIdin interfaceComponent- Specified by:
withUniqueIdin interfaceIComponentUnion- Specified by:
withUniqueIdin interfaceSectionContentComponent- Parameters:
uniqueId- The new ID; must be higher or equal to 1- Returns:
- The new component
-