Class Message

java.lang.Object
com.hubspot.slack.client.models.Message
All Implemented Interfaces:
MessageIF

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

Use the builder to create immutable instances: Message.builder().

  • Method Details

    • getType

      public String getType()
      Specified by:
      getType in interface MessageIF
      Returns:
      The value of the type attribute
    • getTeam

      public String getTeam()
      Specified by:
      getTeam in interface MessageIF
      Returns:
      The value of the team attribute
    • getChannel

      public SlackChannel getChannel()
      Specified by:
      getChannel in interface MessageIF
      Returns:
      The value of the channel attribute
    • getUser

      public Optional<String> getUser()
      Specified by:
      getUser in interface MessageIF
      Returns:
      The value of the user attribute
    • getUsername

      public String getUsername()
      Specified by:
      getUsername in interface MessageIF
      Returns:
      The value of the username attribute
    • getTimestamp

      public String getTimestamp()
      Specified by:
      getTimestamp in interface MessageIF
      Returns:
      The value of the timestamp attribute
    • getText

      public String getText()
      Specified by:
      getText in interface MessageIF
      Returns:
      The value of the text attribute
    • getPermalink

      public Optional<String> getPermalink()
      Specified by:
      getPermalink in interface MessageIF
      Returns:
      The value of the permalink attribute
    • getAttachments

      public List<Attachment> getAttachments()
      Specified by:
      getAttachments in interface MessageIF
      Returns:
      The value of the attachments attribute
    • getPreviousPrevious

      public Optional<LiteMessage> getPreviousPrevious()
      Specified by:
      getPreviousPrevious in interface MessageIF
      Returns:
      The value of the previousPrevious attribute
    • getPrevious

      public Optional<LiteMessage> getPrevious()
      Specified by:
      getPrevious in interface MessageIF
      Returns:
      The value of the previous attribute
    • getNext

      public Optional<LiteMessage> getNext()
      Specified by:
      getNext in interface MessageIF
      Returns:
      The value of the next attribute
    • getNextNext

      public Optional<LiteMessage> getNextNext()
      Specified by:
      getNextNext in interface MessageIF
      Returns:
      The value of the nextNext attribute
    • getSlackLink

      public String getSlackLink()
      Specified by:
      getSlackLink in interface MessageIF
      Returns:
      The computed-at-construction value of the slackLink attribute
    • withType

      public final Message withType(String value)
      Copy the current immutable object by setting a value for the type attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for type
      Returns:
      A modified copy or the this object
    • withTeam

      public final Message withTeam(String value)
      Copy the current immutable object by setting a value for the team attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for team
      Returns:
      A modified copy or the this object
    • withChannel

      public final Message withChannel(SlackChannel value)
      Copy the current immutable object by setting a value for the channel attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for channel
      Returns:
      A modified copy or the this object
    • withUser

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

      public final Message withUser(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the user 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 user
      Returns:
      A modified copy or this if not changed
    • withUsername

      public final Message withUsername(String value)
      Copy the current immutable object by setting a value for the username attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for username
      Returns:
      A modified copy or the this object
    • withTimestamp

      public final Message withTimestamp(String value)
      Copy the current immutable object by setting a value for the timestamp attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for timestamp
      Returns:
      A modified copy or the this object
    • withText

      public final Message withText(String value)
      Copy the current immutable object by setting a value for the text attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for text
      Returns:
      A modified copy or the this object
    • withPermalink

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

      public final Message withPermalink(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the permalink 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 permalink
      Returns:
      A modified copy or this if not changed
    • withAttachments

      public final Message withAttachments(Attachment... elements)
      Copy the current immutable object with elements that replace the content of attachments.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withAttachments

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

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

      public final Message withPreviousPrevious(Optional<? extends LiteMessage> optional)
      Copy the current immutable object by setting an optional value for the previousPrevious 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 previousPrevious
      Returns:
      A modified copy or this if not changed
    • withPrevious

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

      public final Message withPrevious(Optional<? extends LiteMessage> optional)
      Copy the current immutable object by setting an optional value for the previous 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 previous
      Returns:
      A modified copy or this if not changed
    • withNext

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

      public final Message withNext(Optional<? extends LiteMessage> optional)
      Copy the current immutable object by setting an optional value for the next 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 next
      Returns:
      A modified copy or this if not changed
    • withNextNext

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

      public final Message withNextNext(Optional<? extends LiteMessage> optional)
      Copy the current immutable object by setting an optional value for the nextNext 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 nextNext
      Returns:
      A modified copy or this if not changed
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of Message 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: type, team, channel, user, username, timestamp, text, permalink, attachments, previousPrevious, previous, next, nextNext, slackLink.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static Message copyOf(MessageIF instance)
      Creates an immutable copy of a MessageIF 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 Message instance
    • builder

      public static Message.Builder builder()
      Creates a builder for Message.
       Message.builder()
          .setType(String) // required type
          .setTeam(String) // required team
          .setChannel(com.hubspot.slack.client.models.SlackChannel) // required channel
          .setUser(Optional<String>) // optional user
          .setUsername(String) // required username
          .setTimestamp(String) // required timestamp
          .setText(String) // required text
          .setPermalink(Optional<String>) // optional permalink
          .addAttachments|addAllAttachments(Attachment) // attachments elements
          .setPreviousPrevious(Optional<LiteMessage>) // optional previousPrevious
          .setPrevious(Optional<LiteMessage>) // optional previous
          .setNext(Optional<LiteMessage>) // optional next
          .setNextNext(Optional<LiteMessage>) // optional nextNext
          .build();
       
      Returns:
      A new Message builder