/** * Builds a new {@link ChangeEvent ChangeEvent}. * @return An immutable instance of ChangeEvent * @throws java.lang.IllegalStateException if any required attributes are missing */ public ChangeEvent build() { return ImmutableChangeEvent.validate(new ImmutableChangeEvent(null, action, kind, id)); } }
/** * Copy the current immutable object by setting an optional value for the {@link ChangeEvent#getId() id} 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 id * @return A modified copy of {@code this} object */ public final ImmutableChangeEvent withId(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.id, value)) return this; return validate(new ImmutableChangeEvent(this, this.action, this.kind, value)); }
/** * Copy the current immutable object by setting an optional value for the {@link ChangeEvent#getAction() action} 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 action * @return A modified copy of {@code this} object */ public final ImmutableChangeEvent withAction(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.action, value)) return this; return validate(new ImmutableChangeEvent(this, value, this.kind, this.id)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link ChangeEvent#getId() id} attribute. * @param value The value for id * @return A modified copy of {@code this} object */ public final ImmutableChangeEvent withId(String value) { @Nullable String newValue = Objects.requireNonNull(value, "id"); if (Objects.equals(this.id, newValue)) return this; return validate(new ImmutableChangeEvent(this, this.action, this.kind, newValue)); }
/** * Construct a new immutable {@code ChangeEvent} instance. * @param action The value for the {@code action} attribute * @param kind The value for the {@code kind} attribute * @param id The value for the {@code id} attribute * @return An immutable ChangeEvent instance */ public static ChangeEvent of(Optional<String> action, Optional<String> kind, Optional<String> id) { return validate(new ImmutableChangeEvent(action, kind, id)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link ChangeEvent#getAction() action} attribute. * @param value The value for action * @return A modified copy of {@code this} object */ public final ImmutableChangeEvent withAction(String value) { @Nullable String newValue = Objects.requireNonNull(value, "action"); if (Objects.equals(this.action, newValue)) return this; return validate(new ImmutableChangeEvent(this, newValue, this.kind, this.id)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link ChangeEvent#getKind() kind} attribute. * @param value The value for kind * @return A modified copy of {@code this} object */ public final ImmutableChangeEvent withKind(String value) { @Nullable String newValue = Objects.requireNonNull(value, "kind"); if (Objects.equals(this.kind, newValue)) return this; return validate(new ImmutableChangeEvent(this, this.action, newValue, this.id)); }
/** * Copy the current immutable object by setting an optional value for the {@link ChangeEvent#getKind() kind} 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 kind * @return A modified copy of {@code this} object */ public final ImmutableChangeEvent withKind(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.kind, value)) return this; return validate(new ImmutableChangeEvent(this, this.action, value, this.id)); }