/** * Builds a new {@link Flow Flow}. * @return An immutable instance of Flow * @throws java.lang.IllegalStateException if any required attributes are missing */ public Flow build() { return ImmutableFlow.validate(new ImmutableFlow(this)); }
/** * Construct a new immutable {@code Flow} instance. * @param connections The value for the {@code connections} attribute * @param scheduler The value for the {@code scheduler} attribute * @param description The value for the {@code description} attribute * @param name The value for the {@code name} attribute * @param id The value for the {@code id} attribute * @param kind The value for the {@code kind} attribute * @param tags The value for the {@code tags} attribute * @param steps The value for the {@code steps} attribute * @param metadata The value for the {@code metadata} attribute * @return An immutable Flow instance */ public static Flow of(Iterable<? extends Connection> connections, Optional<Scheduler> scheduler, Optional<String> description, String name, Optional<String> id, Kind kind, Iterable<String> tags, Iterable<? extends Step> steps, Map<String, ? extends String> metadata) { return validate(new ImmutableFlow(connections, scheduler, description, name, id, kind, tags, steps, metadata)); }
/** * Copy the current immutable object by setting a value for the {@link Flow#getKind() kind} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for kind (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableFlow withKind(Kind value) { if (this.kind == value) return this; return validate(new ImmutableFlow( this, this.connections, this.scheduler, this.description, this.name, this.id, value, this.tags, this.steps, this.metadata)); }
/** * Copy the current immutable object by setting a value for the {@link Flow#getName() name} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for name (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableFlow withName(String value) { if (Objects.equals(this.name, value)) return this; return validate(new ImmutableFlow( this, this.connections, this.scheduler, this.description, value, this.id, this.kind, this.tags, this.steps, this.metadata)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Flow#getId() id} attribute. * @param value The value for id * @return A modified copy of {@code this} object */ public final ImmutableFlow withId(String value) { @Nullable String newValue = Objects.requireNonNull(value, "id"); if (Objects.equals(this.id, newValue)) return this; return validate(new ImmutableFlow( this, this.connections, this.scheduler, this.description, this.name, newValue, this.kind, this.tags, this.steps, this.metadata)); }
/** * Copy the current immutable object by setting an optional value for the {@link Flow#getDescription() description} 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 description * @return A modified copy of {@code this} object */ public final ImmutableFlow withDescription(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.description, value)) return this; return validate(new ImmutableFlow( this, this.connections, this.scheduler, value, this.name, this.id, this.kind, this.tags, this.steps, this.metadata)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Flow#getScheduler() scheduler} attribute. * @param value The value for scheduler * @return A modified copy of {@code this} object */ public final ImmutableFlow withScheduler(Scheduler value) { @Nullable Scheduler newValue = Objects.requireNonNull(value, "scheduler"); if (this.scheduler == newValue) return this; return validate(new ImmutableFlow( this, this.connections, newValue, this.description, this.name, this.id, this.kind, this.tags, this.steps, this.metadata)); }
/** * Copy the current immutable object by setting a <i>present</i> value for the optional {@link Flow#getDescription() description} attribute. * @param value The value for description * @return A modified copy of {@code this} object */ public final ImmutableFlow withDescription(String value) { @Nullable String newValue = Objects.requireNonNull(value, "description"); if (Objects.equals(this.description, newValue)) return this; return validate(new ImmutableFlow( this, this.connections, this.scheduler, newValue, this.name, this.id, this.kind, this.tags, this.steps, this.metadata)); }
/** * Copy the current immutable object by setting an optional value for the {@link Flow#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 ImmutableFlow withId(Optional<String> optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.id, value)) return this; return validate(new ImmutableFlow( this, this.connections, this.scheduler, this.description, this.name, value, this.kind, this.tags, this.steps, this.metadata)); }
/** * Copy the current immutable object by setting an optional value for the {@link Flow#getScheduler() scheduler} 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 scheduler * @return A modified copy of {@code this} object */ public final ImmutableFlow withScheduler(Optional<? extends Scheduler> optional) { @Nullable Scheduler value = optional.orElse(null); if (this.scheduler == value) return this; return validate(new ImmutableFlow( this, this.connections, value, this.description, this.name, this.id, this.kind, this.tags, this.steps, this.metadata)); }
/** * Copy the current immutable object by replacing the {@link Flow#getMetadata() metadata} map with the specified map. * Nulls are not permitted as keys or values. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param entries The entries to be added to the metadata map * @return A modified copy of {@code this} object */ public final ImmutableFlow withMetadata(Map<String, ? extends String> entries) { if (this.metadata == entries) return this; Map<String, String> newValue = createUnmodifiableMap(true, false, entries); return validate(new ImmutableFlow( this, this.connections, this.scheduler, this.description, this.name, this.id, this.kind, this.tags, this.steps, newValue)); }
/** * Copy the current immutable object with elements that replace the content of {@link Flow#getConnections() connections}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableFlow withConnections(Connection... elements) { List<Connection> newValue = createUnmodifiableList(false, createSafeList(Arrays.asList(elements), true, false)); return validate(new ImmutableFlow( this, newValue, this.scheduler, this.description, this.name, this.id, this.kind, this.tags, this.steps, this.metadata)); }
/** * Copy the current immutable object with elements that replace the content of {@link Flow#getTags() tags}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableFlow withTags(String... elements) { SortedSet<String> newValue = createUnmodifiableSortedSet(false, createSafeList(Arrays.asList(elements), false, true)); return validate(new ImmutableFlow( this, this.connections, this.scheduler, this.description, this.name, this.id, this.kind, newValue, this.steps, this.metadata)); }
/** * Copy the current immutable object with elements that replace the content of {@link Flow#getSteps() steps}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableFlow withSteps(Step... elements) { List<Step> newValue = createUnmodifiableList(false, createSafeList(Arrays.asList(elements), true, false)); return validate(new ImmutableFlow( this, this.connections, this.scheduler, this.description, this.name, this.id, this.kind, this.tags, newValue, this.metadata)); }
/** * Copy the current immutable object with elements that replace the content of {@link Flow#getConnections() connections}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of connections elements to set * @return A modified copy of {@code this} object */ public final ImmutableFlow withConnections(Iterable<? extends Connection> elements) { if (this.connections == elements) return this; List<Connection> newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return validate(new ImmutableFlow( this, newValue, this.scheduler, this.description, this.name, this.id, this.kind, this.tags, this.steps, this.metadata)); }
/** * Copy the current immutable object with elements that replace the content of {@link Flow#getSteps() steps}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of steps elements to set * @return A modified copy of {@code this} object */ public final ImmutableFlow withSteps(Iterable<? extends Step> elements) { if (this.steps == elements) return this; List<Step> newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return validate(new ImmutableFlow( this, this.connections, this.scheduler, this.description, this.name, this.id, this.kind, this.tags, newValue, this.metadata)); }
/** * Copy the current immutable object with elements that replace the content of {@link Flow#getTags() tags}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of tags elements to set * @return A modified copy of {@code this} object */ public final ImmutableFlow withTags(Iterable<String> elements) { if (this.tags == elements) return this; SortedSet<String> newValue = createUnmodifiableSortedSet(false, createSafeList(elements, false, true)); return validate(new ImmutableFlow( this, this.connections, this.scheduler, this.description, this.name, this.id, this.kind, newValue, this.steps, this.metadata)); }