/** * Copy the current immutable object with elements that replace the content of {@link TxResponse#results() results}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of results elements to set * @return A modified copy of {@code this} object */ public final ImmutableTxResponse withResults(Iterable<? extends Map<String, Value>> elements) { if (this.results == elements) return this; ImmutableList<Map<String, Value>> newValue = ImmutableList.copyOf(elements); return new ImmutableTxResponse(newValue, this.errors); }
/** * This instance is equal to all instances of {@code ImmutableTxResponse} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { if (this == another) return true; return another instanceof ImmutableTxResponse && equalTo((ImmutableTxResponse) another); }
/** * Creates an immutable copy of a {@link TxResponse} 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 TxResponse instance */ public static ImmutableTxResponse copyOf(TxResponse instance) { if (instance instanceof ImmutableTxResponse) { return (ImmutableTxResponse) instance; } return ImmutableTxResponse.builder() .from(instance) .build(); }
/** * @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 ImmutableTxResponse fromJson(Json json) { ImmutableTxResponse.Builder builder = ImmutableTxResponse.builder(); if (json.results != null) { builder.addAllResults(json.results); } if (json.errors != null) { builder.addAllErrors(json.errors); } return builder.build(); }
/** * Copy the current immutable object with elements that replace the content of {@link TxResponse#errors() errors}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableTxResponse withErrors(TxError... elements) { ImmutableList<TxError> newValue = ImmutableList.copyOf(elements); return new ImmutableTxResponse(this.results, newValue); }
/** * Copy the current immutable object with elements that replace the content of {@link TxResponse#errors() errors}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of errors elements to set * @return A modified copy of {@code this} object */ public final ImmutableTxResponse withErrors(Iterable<? extends TxError> elements) { if (this.errors == elements) return this; ImmutableList<TxError> newValue = ImmutableList.copyOf(elements); return new ImmutableTxResponse(this.results, newValue); }
/** * Copy the current immutable object with elements that replace the content of {@link TxResponse#results() results}. * @param elements The elements to set * @return A modified copy of {@code this} object */ @SafeVarargs public final ImmutableTxResponse withResults(Map<String, Value>... elements) { ImmutableList<Map<String, Value>> newValue = ImmutableList.copyOf(elements); return new ImmutableTxResponse(newValue, this.errors); }
/** * Builds a new {@link ImmutableTxResponse ImmutableTxResponse}. * @return An immutable instance of TxResponse * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableTxResponse build() { return new ImmutableTxResponse(resultsBuilder.build(), errorsBuilder.build()); } }