/** * Construct a new immutable {@code EventResponse} instance. * @param events The value for the {@code events} attribute * @param index The value for the {@code index} attribute * @return An immutable EventResponse instance */ public static ImmutableEventResponse of(Iterable<? extends Event> events, BigInteger index) { return new ImmutableEventResponse(events, index); }
/** * Copy the current immutable object by setting a value for the {@link EventResponse#getIndex() index} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for index * @return A modified copy of the {@code this} object */ public final ImmutableEventResponse withIndex(BigInteger value) { if (this.index == value) return this; return new ImmutableEventResponse(this, this.events, Preconditions.checkNotNull(value, "index")); }
/** * Copy the current immutable object with elements that replace the content of {@link EventResponse#getEvents() events}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableEventResponse withEvents(Event... elements) { ImmutableList<Event> newValue = ImmutableList.copyOf(elements); return new ImmutableEventResponse(this, newValue, this.index); }
/** * Copy the current immutable object with elements that replace the content of {@link EventResponse#getEvents() events}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of events elements to set * @return A modified copy of {@code this} object */ public final ImmutableEventResponse withEvents(Iterable<? extends Event> elements) { if (this.events == elements) return this; ImmutableList<Event> newValue = ImmutableList.copyOf(elements); return new ImmutableEventResponse(this, newValue, this.index); }
/** * Builds a new {@link ImmutableEventResponse ImmutableEventResponse}. * @return An immutable instance of EventResponse * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableEventResponse build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableEventResponse(null, eventsBuilder.build(), index); }