Class ImmutableEventResponse

java.lang.Object
org.kiwiproject.consul.model.EventResponse
org.kiwiproject.consul.model.ImmutableEventResponse

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableEventResponse extends EventResponse
Immutable implementation of EventResponse.

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

  • Method Details

    • getEvents

      public com.google.common.collect.ImmutableList<Event> getEvents()
      Specified by:
      getEvents in class EventResponse
      Returns:
      The value of the events attribute
    • getIndex

      public BigInteger getIndex()
      Specified by:
      getIndex in class EventResponse
      Returns:
      The value of the index attribute
    • withEvents

      public final ImmutableEventResponse withEvents(Event... elements)
      Copy the current immutable object with elements that replace the content of events.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withEvents

      public final ImmutableEventResponse withEvents(Iterable<? extends Event> elements)
      Copy the current immutable object with elements that replace the content of events. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of events elements to set
      Returns:
      A modified copy of this object
    • withIndex

      public final ImmutableEventResponse withIndex(BigInteger value)
      Copy the current immutable object by setting a value for the index attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for index
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableEventResponse 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: events, index.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableEventResponse of(List<Event> events, BigInteger index)
      Construct a new immutable EventResponse instance.
      Parameters:
      events - The value for the events attribute
      index - The value for the index attribute
      Returns:
      An immutable EventResponse instance
    • of

      public static ImmutableEventResponse of(Iterable<? extends Event> events, BigInteger index)
      Construct a new immutable EventResponse instance.
      Parameters:
      events - The value for the events attribute
      index - The value for the index attribute
      Returns:
      An immutable EventResponse instance
    • copyOf

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

      public static ImmutableEventResponse.Builder builder()
      Creates a builder for ImmutableEventResponse.
       ImmutableEventResponse.builder()
          .addEvents|addAllEvents(org.kiwiproject.consul.model.event.Event) // events elements
          .index(java.math.BigInteger) // required index
          .build();
       
      Returns:
      A new ImmutableEventResponse builder