Class SeparatedContainer
java.lang.Object
io.github.kaktushose.jdac.components.internal.AbstractSequencedContainer<ContainerChildComponent, SeparatedContainer>
io.github.kaktushose.jdac.components.container.SeparatedContainer
- All Implemented Interfaces:
LocalizedComponent, SequencedComponent<ContainerChildComponent>, IDisableable, Component, Container, IComponentUnion, MessageTopLevelComponent, MessageTopLevelComponentUnion, IReplaceable, SerializableData
public final class SeparatedContainer
extends AbstractSequencedContainer<ContainerChildComponent, SeparatedContainer>
An implementation of
SequencedContainer that always adds a Separator between its elements.-
Nested Class Summary
Nested classes/interfaces inherited from interface Component
Component.Type -
Field Summary
Fields inherited from class AbstractSequencedContainer
container, entries -
Constructor Summary
ConstructorsConstructorDescriptionSeparatedContainer(Resolver<String> resolver, Locale locale, ContainerChildComponent header, Separator separator) Constructs a newSeparatedContainer.SeparatedContainer(Resolver<String> resolver, DiscordLocale locale, ContainerChildComponent header, Separator separator) Constructs a newSeparatedContainer. -
Method Summary
Modifier and TypeMethodDescriptionadd(ContainerChildComponent component, Entry... entries) Appends the provided element to the end of this component.add(ContainerChildComponent component, @Nullable Separator separator, Entry... entries) Appends a component to the end of this container.addFirst(ContainerChildComponent component, Entry... entries) Adds the provided element to this component as the first element of this component.addFirst(ContainerChildComponent component, @Nullable Separator separator, Entry... entries) Adds the provided element to this component as the first element of this component.addLast(ContainerChildComponent component, Entry... entries) Adds the provided element to this component as the last element of this component.addUnseparated(ContainerChildComponent component, Entry... entries) Appends a component to the end of this container without appending aSeparator.static SeparatedContainerof(ContainerChildComponent header, Separator separator) Constructs a newSeparatedContainerfrom the given component.protected SeparatedContainerself()Methods inherited from class AbstractSequencedContainer
addAll, asActionRow, asContainer, asDisabled, asEnabled, asFileDisplay, asMediaGallery, asSection, asSeparator, asTextDisplay, checkAccess, entries, entries, getAccentColorRaw, getComponents, getType, getUniqueId, isSpoiler, locale, locale, locale, replace, toData, withAccentColor, withAccentColor, withComponents, withComponents, withDisabled, withSpoiler, withUniqueIdMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Container
getAccentColor, isDisabled, isEnabled, isMessageCompatible, isModalCompatibleMethods inherited from interface IComponentUnion
isUnknownComponent
-
Constructor Details
-
SeparatedContainer
public SeparatedContainer(Resolver<String> resolver, DiscordLocale locale, ContainerChildComponent header, Separator separator) Constructs a newSeparatedContainer. -
SeparatedContainer
public SeparatedContainer(Resolver<String> resolver, Locale locale, ContainerChildComponent header, Separator separator) Constructs a newSeparatedContainer.
-
-
Method Details
-
of
Constructs a new
SeparatedContainerfrom the given component.This method can only be used inside events or in methods annotated with
IntrospectionAccess.- Parameters:
header- the first component of this containerseparator- theSeparatorto use to divide elements- Throws:
ReplyException- if theJDACScope.PREPARATIONisn't accessible.
-
self
- Specified by:
selfin classAbstractSequencedContainer<ContainerChildComponent, SeparatedContainer>
-
add
Appends the provided element to the end of this component. Automatically appends the defaultSeparatorafter the component. Useadd(ContainerChildComponent, Separator, Entry...)to override.- Specified by:
addin interfaceSequencedComponent<ContainerChildComponent>- Overrides:
addin classAbstractSequencedContainer<ContainerChildComponent, SeparatedContainer>- Parameters:
component- the component to addentries- the Entries used for localization- Returns:
- this instance for fluent interface
-
add
public SeparatedContainer add(ContainerChildComponent component, @Nullable Separator separator, Entry... entries) -
addFirst
Adds the provided element to this component as the first element of this component.
Automatically appends the default
Separatorafter the component. Useadd(ContainerChildComponent, Separator, Entry...)to override.- Specified by:
addFirstin interfaceSequencedComponent<ContainerChildComponent>- Overrides:
addFirstin classAbstractSequencedContainer<ContainerChildComponent, SeparatedContainer>- Parameters:
component- the component to addentries- the Entries used for localization- Returns:
- this instance for fluent interface
-
addFirst
public SeparatedContainer addFirst(ContainerChildComponent component, @Nullable Separator separator, Entry... entries) -
addUnseparated
-
addLast
Adds the provided element to this component as the last element of this component.
This method doesn't append a
Separatorand should thus be used for the last component of the container.- Specified by:
addLastin interfaceSequencedComponent<ContainerChildComponent>- Overrides:
addLastin classAbstractSequencedContainer<ContainerChildComponent, SeparatedContainer>- Parameters:
component- the component to addentries- the Entries used for localization- Returns:
- this instance for fluent interface
-