/** * Builds a new {@link ImmutableTransactionOptions ImmutableTransactionOptions}. * @return An immutable instance of TransactionOptions * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableTransactionOptions build() { return new ImmutableTransactionOptions(this); } }
/** * Copy the current immutable object by setting a value for the {@link TransactionOptions#getConsistencyMode() consistencyMode} 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 consistencyMode * @return A modified copy of the {@code this} object */ public final ImmutableTransactionOptions withConsistencyMode(ConsistencyMode value) { if (this.consistencyMode == value) return this; return new ImmutableTransactionOptions(this.datacenter, Preconditions.checkNotNull(value, "consistencyMode")); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link TransactionOptions#getDatacenter() datacenter} attribute. * @param value The value for datacenter * @return A modified copy of {@code this} object */ public final ImmutableTransactionOptions withDatacenter(String value) { @Nullable String newValue = Preconditions.checkNotNull(value, "datacenter"); if (Objects.equals(this.datacenter, newValue)) return this; return new ImmutableTransactionOptions(newValue, this.consistencyMode); }
/** * Copy the current immutable object by setting an optional value for the {@link TransactionOptions#getDatacenter() datacenter} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for datacenter * @return A modified copy of {@code this} object */ public final ImmutableTransactionOptions withDatacenter(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.datacenter, value)) return this; return new ImmutableTransactionOptions(value, this.consistencyMode); }