Class AbstractComponent

java.lang.Object
net.kyori.adventure.text.AbstractComponent
All Implemented Interfaces:
Component, ComponentBuilderApplicable, ComponentLike, HoverEventSource<Component>, net.kyori.examination.Examinable

public abstract class AbstractComponent
extends Object
implements Component
An abstract implementation of a text component.
Since:
4.0.0
  • Field Details

    • children

      protected final List<Component> children
      The list of children.
    • style

      protected final Style style
      The style of this component.
  • Constructor Details

    • AbstractComponent

      protected AbstractComponent​(@NonNull List<? extends ComponentLike> children, @NonNull Style style)
  • Method Details

    • children

      public final @NonNull List<Component> children()
      Description copied from interface: Component
      Gets the unmodifiable list of children.
      Specified by:
      children in interface Component
      Returns:
      the unmodifiable list of children
    • style

      public final @NonNull Style style()
      Description copied from interface: Component
      Gets the style of this component.
      Specified by:
      style in interface Component
      Returns:
      the style of this component
    • replaceText

      public @NonNull Component replaceText​(@NonNull Consumer<TextReplacementConfig.Builder> configurer)
      Description copied from interface: Component
      Finds and replaces any text with this or child Components using the configured options.
      Specified by:
      replaceText in interface Component
      Parameters:
      configurer - the configurer
      Returns:
      a modified copy of this component
    • replaceText

      public @NonNull Component replaceText​(@NonNull TextReplacementConfig config)
      Description copied from interface: Component
      Finds and replaces any text with this or child Components using the provided options.
      Specified by:
      replaceText in interface Component
      Parameters:
      config - the replacement config
      Returns:
      a modified copy of this component
    • equals

      public boolean equals​(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • examinableProperties

      public @NonNull Stream<? extends net.kyori.examination.ExaminableProperty> examinableProperties()
      Specified by:
      examinableProperties in interface net.kyori.examination.Examinable
    • toString

      public String toString()
      Overrides:
      toString in class Object