/** * @param json A JSON-bindable data structure * @return An immutable value type * @deprecated Do not use this method directly, it exists only for the <em>Jackson</em>-binding infrastructure */ @Deprecated @JsonCreator static ImmutableEventResponse fromJson(Json json) { ImmutableEventResponse.Builder builder = ImmutableEventResponse.builder(); if (json.events != null) { builder.addAllEvents(json.events); } if (json.index != null) { builder.index(json.index); } return builder.build(); }
/** * 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); }
/** * Creates an immutable copy of a {@link EventResponse} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable EventResponse instance */ public static ImmutableEventResponse copyOf(EventResponse instance) { if (instance instanceof ImmutableEventResponse) { return (ImmutableEventResponse) instance; } return ImmutableEventResponse.builder() .from(instance) .build(); }
/** * Fill a builder with attribute values from the provided {@code EventResponse} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(EventResponse instance) { Preconditions.checkNotNull(instance, "instance"); addAllEvents(instance.getEvents()); index(instance.getIndex()); return this; }
/** * Creates a builder for {@link ImmutableEventResponse ImmutableEventResponse}. * @return A new ImmutableEventResponse builder */ public static ImmutableEventResponse.Builder builder() { return new ImmutableEventResponse.Builder(); }
/** * Sets or replaces all elements for {@link EventResponse#getEvents() events} list. * @param elements An iterable of events elements * @return {@code this} builder for use in a chained invocation */ public final Builder events(Iterable<? extends Event> elements) { eventsBuilder = ImmutableList.builder(); return addAllEvents(elements); }