java.lang.Object
com.hubspot.slack.client.models.blocks.Section
All Implemented Interfaces:
BlockOrAttachment, Block, ContainerChildBlock, SectionIF, ChatUnfurlBlocksOrAttachment

@Generated(from="SectionIF", generator="Immutables") @ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class Section extends Object implements SectionIF
Immutable implementation of SectionIF.

Use the builder to create immutable instances: Section.builder(). Use the static factory method to create immutable instances: Section.of().

  • Method Details

    • getBlockId

      public Optional<String> getBlockId()
      Specified by:
      getBlockId in interface Block
      Returns:
      The value of the blockId attribute
    • getType

      public String getType()
      Specified by:
      getType in interface Block
      Specified by:
      getType in interface SectionIF
      Returns:
      The computed-at-construction value of the type attribute
    • getText

      @Nullable public Text getText()
      Specified by:
      getText in interface SectionIF
      Returns:
      The value of the text attribute
    • getFields

      public List<Text> getFields()
      Specified by:
      getFields in interface SectionIF
      Returns:
      The value of the fields attribute
    • getAccessory

      public Optional<BlockElement> getAccessory()
      Specified by:
      getAccessory in interface SectionIF
      Returns:
      The value of the accessory attribute
    • withBlockId

      public final Section withBlockId(@Nullable String value)
      Copy the current immutable object by setting a present value for the optional blockId attribute.
      Parameters:
      value - The value for blockId, null is accepted as java.util.Optional.empty()
      Returns:
      A modified copy or this if not changed
    • withBlockId

      public final Section withBlockId(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the blockId attribute. An equality check is used on inner value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for blockId
      Returns:
      A modified copy or this if not changed
    • withText

      public final Section withText(@Nullable Text value)
      Copy the current immutable object by setting a value for the text attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for text (can be null)
      Returns:
      A modified copy or the this object
    • withFields

      public final Section withFields(Text... elements)
      Copy the current immutable object with elements that replace the content of fields.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withFields

      public final Section withFields(Iterable<? extends Text> elements)
      Copy the current immutable object with elements that replace the content of fields. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of fields elements to set
      Returns:
      A modified copy or this if not changed
    • withAccessory

      public final Section withAccessory(@Nullable BlockElement value)
      Copy the current immutable object by setting a present value for the optional accessory attribute.
      Parameters:
      value - The value for accessory, null is accepted as java.util.Optional.empty()
      Returns:
      A modified copy or this if not changed
    • withAccessory

      public final Section withAccessory(Optional<? extends BlockElement> optional)
      Copy the current immutable object by setting an optional value for the accessory attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for accessory
      Returns:
      A modified copy or this if not changed
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of Section that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: blockId, type, text, fields, accessory.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Section with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static Section of(@Nullable Text text)
      Construct a new immutable Section instance.
      Parameters:
      text - The value for the text attribute
      Returns:
      An immutable Section instance
    • copyOf

      public static Section copyOf(SectionIF instance)
      Creates an immutable copy of a SectionIF value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable Section instance
    • builder

      public static Section.Builder builder()
      Creates a builder for Section.
       Section.builder()
          .setBlockId(Optional<String>) // optional blockId
          .setText(com.hubspot.slack.client.models.blocks.objects.Text | null) // nullable text
          .addFields|addAllFields(com.hubspot.slack.client.models.blocks.objects.Text) // fields elements
          .setAccessory(Optional<com.hubspot.slack.client.models.blocks.elements.BlockElement>) // optional accessory
          .build();
       
      Returns:
      A new Section builder