/** * 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#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)); }
this.id = id.orElse(null); this.kind = kind; this.tags = createUnmodifiableSortedSet(false, createSafeList(tags, false, true)); this.steps = createUnmodifiableList(false, createSafeList(steps, true, false)); this.metadata = createUnmodifiableMap(true, false, metadata);
private ImmutableFlow(ImmutableFlow.Builder builder) { this.scheduler = builder.scheduler; this.description = builder.description; this.name = builder.name; this.id = builder.id; this.kind = builder.kind; this.tags = createUnmodifiableSortedSet(false, createSafeList(builder.tags, false, false)); if (builder.connectionsIsSet()) { initShim.connections(createUnmodifiableList(true, builder.connections)); } if (builder.stepsIsSet()) { initShim.steps(createUnmodifiableList(true, builder.steps)); } if (builder.metadataIsSet()) { initShim.metadata(createUnmodifiableMap(false, false, builder.metadata)); } this.connections = initShim.getConnections(); this.steps = initShim.getSteps(); this.metadata = initShim.getMetadata(); this.initShim = null; }