Class RealizedStep
- All Implemented Interfaces:
AutoCloseable
A Step that has been realized, such that it has produced valid output. A RealizedStep is a linked
traversable DAG in itself, and so is a sort of realized Pipeline whose outputs can be used.
-
Constructor Summary
ConstructorsConstructorDescriptionRealizedStep(String name, @NonNull Step implementation, StepDefinition ast, @NonNull ResultOrProblems<? extends Realized> result, @NonNull Map<String, List<?>> boundParameters, @NonNull List<RealizedStep> dependencies, @NonNull Struct produces) Creates a newRealizedStepinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanvoidclose()static RealizedStepemptyInput(String name, Struct type) booleanstatic RealizedStepfromInput(RealizationInput input) getAst()The part of the syntax tree that defined this stepThe complete set ofParameters that were used to realize this step.@NonNull List<RealizedStep>The complete set ofRealizedSteps that were used to realize this step@NonNull StepTheStepthat produced a realized output that went in to thisRealizedStepgetName()@NonNull StructgetRealized(Class<T> stepType) Returns the realized result of this step, cast to a given type.@NonNull ResultOrProblems<? extends Realized>The output of the step.booleaninthashCode()booleanbooleanbooleanisFailed()static RealizedSteprealizedBy(Step step) Clone this step, setting theStepimplementation that realized it.toString()withAst(StepDefinition defn) Clone this step, replacing theStepDefinitionthat is said to have realized this step.withDependencies(List<RealizedStep> newDependencies) Clone this step, replacing the dependencieswithDependencies(RealizedStep... newDependencies) Convenience version ofwithDependencies(List)Clone this step, giving it a new namewithParameters(Map<String, List<?>> newParams) Clone this step, replacing the parameters with the given oneswithProblems(List<Problem> problems) Clones this RealizedStep with only given problems, marking it as failed if problem list has errorswithProblems(Problem... problems) Convenience version ofwithProblems(List)withResult(Realized realized) Clone this step, replacing the realized result and setting the produced type to be from that result as wellwithResult(Realized realized, Struct newType) Clone this step, replacing the result and realized typewithResult(ResultOrProblems<? extends Realized> realizedOr) Clone this step, replacing the realized result and setting the produced type to be from that result as well (setting it to the empty struct if it's failed)
-
Constructor Details
-
RealizedStep
public RealizedStep(String name, @NonNull @NonNull Step implementation, StepDefinition ast, @NonNull @NonNull ResultOrProblems<? extends Realized> result, @NonNull @NonNull Map<String, List<?>> boundParameters, @NonNull @NonNull List<RealizedStep> dependencies, @NonNull @NonNull Struct produces) Creates a new
RealizedStepinstance.- Parameters:
name- The name that was assigned to this step - unique within the pipelineimplementation- TheStepthat produced a realized output that went in to thisRealizedStepast- The part of the syntax tree that defined this stepresult- The output of the step. TODO drop theResultOrProblems?boundParameters- The complete set ofParameters that were used to realize this step.dependencies- The complete set ofRealizedSteps that were used to realize this stepproduces-
-
-
Method Details
-
emptyInput
- Returns:
- a RealizedStep useful for testing scenarios where you want to test realization of some pipeline bits appended to something
-
named
- Returns:
- a RealizedStep with a name and nothing else
-
fromInput
- Returns:
- a RealizedStep with name, ast, parameters, and dependencies set from the given realization input (but not
the
Realizedobject and its type)
-
isFailed
public boolean isFailed()- Returns:
- true if this step or a dependency failed
-
isDirectlyFailed
public boolean isDirectlyFailed()- Returns:
- true if this step failed, but not if that failure was because of a dependency
-
hasDependencies
public boolean hasDependencies()- Returns:
- true if this step has any direct dependencies
-
hasNoDependencies
public boolean hasNoDependencies()- Returns:
- false if this step has any direct dependenices
-
getName
- Returns:
- the name assigned to this step, either explicitly in the AST, or a generated one based on the
StepNamingPolicy
-
getStepName
-
toString
-
getFailureProblem
- Returns:
- a composite problem for all errors associated with realizing this step, or empty if there were no errors
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getStepType
-
getRealized
Returns the realized result of this step, cast to a given type. Mostly useful for internal workings where the step is assumed to be of a specific type, as it deals in
Optionals, notResultOrProblems- Parameters:
stepType- The type of the result- Returns:
- The realized result, or
emptyif this step failed to realize, or if the step isn't of the given step type
-
getProblems
- Returns:
- a list of problems from the attempt to realize this step, or an empty list if it didn't have problems during realization
-
withProblems
Convenience version of
withProblems(List) -
withProblems
Clones this RealizedStep with only given problems, marking it as failed if problem list has errors
-
realizedBy
Clone this step, setting the
Stepimplementation that realized it. -
withResult
Clone this step, replacing the realized result and setting the produced type to be from that result as well (setting it to the empty struct if it's failed)
-
withResult
Clone this step, replacing the realized result and setting the produced type to be from that result as well
-
withResult
Clone this step, replacing the result and realized type
-
withName
Clone this step, giving it a new name
-
withDependencies
Convenience version of
withDependencies(List) -
withDependencies
Clone this step, replacing the dependencies
-
withParameters
Clone this step, replacing the parameters with the given ones
-
withAst
Clone this step, replacing the
StepDefinitionthat is said to have realized this step. -
getImplementation
The
Stepthat produced a realized output that went in to thisRealizedStep -
getAst
The part of the syntax tree that defined this step
-
getResult
The output of the step. TODO drop the
ResultOrProblems? -
getBoundParameters
The complete set of
Parameters that were used to realize this step. -
getDependencies
The complete set of
RealizedSteps that were used to realize this step -
getProduces
-
equals
-
canEqual
-
hashCode
public int hashCode()
-