Class ImmutableMessage

java.lang.Object
io.resys.thena.api.envelope.ImmutableMessage
All Implemented Interfaces:
Message

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

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

  • Method Details

    • getText

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

      @Nullable public Throwable getException()
      Specified by:
      getException in interface Message
      Returns:
      The value of the exception attribute
    • withText

      public final ImmutableMessage 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
    • withException

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

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableMessage 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: text, exception.
      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 ImmutableMessage copyOf(Message instance)
      Creates an immutable copy of a Message 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 ImmutableMessage.Builder builder()
      Creates a builder for ImmutableMessage.
       ImmutableMessage.builder()
          .text(String) // required text
          .exception(Throwable | null) // nullable exception
          .build();
       
      Returns:
      A new ImmutableMessage builder