private ImmutableStepDescriptor(ImmutableStepDescriptor.Builder builder) { this.kind = builder.kind; this.entrypoint = builder.entrypoint; this.resource = builder.resource; this.inputDataShape = builder.inputDataShape; this.outputDataShape = builder.outputDataShape; this.propertyDefinitionSteps = builder.propertyDefinitionStepsIsSet() ? createUnmodifiableList(true, builder.propertyDefinitionSteps) : createUnmodifiableList(false, createSafeList(StepDescriptor.super.getPropertyDefinitionSteps(), true, false)); }
private ImmutableStepDescriptor( StepAction.Kind kind, String entrypoint, String resource, Optional<DataShape> inputDataShape, Optional<DataShape> outputDataShape, Iterable<? extends ActionDescriptor.ActionDescriptorStep> propertyDefinitionSteps) { this.kind = kind; this.entrypoint = entrypoint; this.resource = resource; this.inputDataShape = inputDataShape.orElse(null); this.outputDataShape = outputDataShape.orElse(null); this.propertyDefinitionSteps = createUnmodifiableList(false, createSafeList(propertyDefinitionSteps, true, false)); }
/** * Copy the current immutable object with elements that replace the content of {@link StepDescriptor#getPropertyDefinitionSteps() propertyDefinitionSteps}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableStepDescriptor withPropertyDefinitionSteps(ActionDescriptor.ActionDescriptorStep... elements) { List<ActionDescriptor.ActionDescriptorStep> newValue = createUnmodifiableList(false, createSafeList(Arrays.asList(elements), true, false)); return validate(new ImmutableStepDescriptor( this, this.kind, this.entrypoint, this.resource, this.inputDataShape, this.outputDataShape, newValue)); }
/** * Copy the current immutable object with elements that replace the content of {@link StepDescriptor#getPropertyDefinitionSteps() propertyDefinitionSteps}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of propertyDefinitionSteps elements to set * @return A modified copy of {@code this} object */ public final ImmutableStepDescriptor withPropertyDefinitionSteps(Iterable<? extends ActionDescriptor.ActionDescriptorStep> elements) { if (this.propertyDefinitionSteps == elements) return this; List<ActionDescriptor.ActionDescriptorStep> newValue = createUnmodifiableList(false, createSafeList(elements, true, false)); return validate(new ImmutableStepDescriptor( this, this.kind, this.entrypoint, this.resource, this.inputDataShape, this.outputDataShape, newValue)); }