/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Operation#flags() flags} attribute. * @param value The value for flags * @return A modified copy of {@code this} object */ public final ImmutableOperation withFlags(long value) { @Nullable Long newValue = value; if (Objects.equals(this.flags, newValue)) return this; return new ImmutableOperation(this.verb, this.key, this.value, newValue, this.index, this.session); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Operation#index() index} attribute. * @param value The value for index * @return A modified copy of {@code this} object */ public final ImmutableOperation withIndex(BigInteger value) { @Nullable BigInteger newValue = Preconditions.checkNotNull(value, "index"); if (this.index == newValue) return this; return new ImmutableOperation(this.verb, this.key, this.value, this.flags, newValue, this.session); }
/** * Copy the current immutable object by setting an optional value for the {@link Operation#key() key} 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 key * @return A modified copy of {@code this} object */ public final ImmutableOperation withKey(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.key, value)) return this; return new ImmutableOperation(this.verb, value, this.value, this.flags, this.index, this.session); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Operation#value() value} attribute. * @param value The value for value * @return A modified copy of {@code this} object */ public final ImmutableOperation withValue(String value) { @Nullable String newValue = Preconditions.checkNotNull(value, "value"); if (Objects.equals(this.value, newValue)) return this; return new ImmutableOperation(this.verb, this.key, newValue, this.flags, this.index, this.session); }
/** * Copy the current immutable object by setting an optional value for the {@link Operation#index() index} attribute. * A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning {@code this}. * @param optional A value for index * @return A modified copy of {@code this} object */ public final ImmutableOperation withIndex(Optional<BigInteger> optional) { @Nullable BigInteger value = optional.orElse(null); if (this.index == value) return this; return new ImmutableOperation(this.verb, this.key, this.value, this.flags, value, this.session); }
/** * Copy the current immutable object by setting an optional value for the {@link Operation#flags() flags} 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 flags * @return A modified copy of {@code this} object */ public final ImmutableOperation withFlags(Optional<Long> optional) { @Nullable Long value = optional.orElse(null); if (Objects.equals(this.flags, value)) return this; return new ImmutableOperation(this.verb, this.key, this.value, value, this.index, this.session); }
/** * Copy the current immutable object by setting an optional value for the {@link Operation#value() value} 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 value * @return A modified copy of {@code this} object */ public final ImmutableOperation withValue(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.value, value)) return this; return new ImmutableOperation(this.verb, this.key, value, this.flags, this.index, this.session); }
/** * Copy the current immutable object by setting an optional value for the {@link Operation#session() session} 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 session * @return A modified copy of {@code this} object */ public final ImmutableOperation withSession(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.session, value)) return this; return new ImmutableOperation(this.verb, this.key, this.value, this.flags, this.index, value); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Operation#key() key} attribute. * @param value The value for key * @return A modified copy of {@code this} object */ public final ImmutableOperation withKey(String value) { @Nullable String newValue = Preconditions.checkNotNull(value, "key"); if (Objects.equals(this.key, newValue)) return this; return new ImmutableOperation(this.verb, newValue, this.value, this.flags, this.index, this.session); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Operation#session() session} attribute. * @param value The value for session * @return A modified copy of {@code this} object */ public final ImmutableOperation withSession(String value) { @Nullable String newValue = Preconditions.checkNotNull(value, "session"); if (Objects.equals(this.session, newValue)) return this; return new ImmutableOperation(this.verb, this.key, this.value, this.flags, this.index, newValue); }
/** * Copy the current immutable object by setting a value for the {@link Operation#verb() verb} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for verb * @return A modified copy of the {@code this} object */ public final ImmutableOperation withVerb(String value) { if (this.verb.equals(value)) return this; return new ImmutableOperation( Preconditions.checkNotNull(value, "verb"), this.key, this.value, this.flags, this.index, this.session); }
/** * Builds a new {@link ImmutableOperation ImmutableOperation}. * @return An immutable instance of Operation * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableOperation build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableOperation(verb, key, value, flags, index, session); }