Package io.serverlessworkflow.api
Class WorkflowReader
java.lang.Object
io.serverlessworkflow.api.WorkflowReader
Utility class for reading and parsing Serverless Workflow definitions from various sources.
-
Method Summary
Modifier and TypeMethodDescriptionstatic WorkflowReaderOperationsReturns aWorkflowReaderOperationsinstance that performs no validation.static io.serverlessworkflow.api.types.WorkflowreadWorkflow(byte[] input, WorkflowFormat format) Reads a workflow from a byte array using the specified format.static io.serverlessworkflow.api.types.WorkflowreadWorkflow(InputStream input, WorkflowFormat format) Reads a workflow from anInputStreamusing the specified format.static io.serverlessworkflow.api.types.WorkflowreadWorkflow(Reader input, WorkflowFormat format) Reads a workflow from aReaderusing the specified format.static io.serverlessworkflow.api.types.WorkflowreadWorkflow(Path path) Reads a workflow from a file path, inferring the format from the file extension.static io.serverlessworkflow.api.types.WorkflowreadWorkflow(Path path, WorkflowFormat format) Reads a workflow from a file path using the specified format.static io.serverlessworkflow.api.types.WorkflowreadWorkflow(Path path, WorkflowFormat format, WorkflowReaderOperations reader) Reads a workflow from a file path using the specified format and custom reader.static io.serverlessworkflow.api.types.WorkflowreadWorkflow(Path path, WorkflowReaderOperations reader) Reads a workflow from a file path using a custom reader.static io.serverlessworkflow.api.types.WorkflowreadWorkflowFromClasspath(String classpath) Reads a workflow from the classpath, inferring the format from the file name.static io.serverlessworkflow.api.types.WorkflowreadWorkflowFromClasspath(String classpath, WorkflowReaderOperations reader) Reads a workflow from the classpath using a custom reader.static io.serverlessworkflow.api.types.WorkflowreadWorkflowFromClasspath(String classpath, ClassLoader cl, WorkflowFormat format) Reads a workflow from the classpath using the specified class loader and format.static io.serverlessworkflow.api.types.WorkflowreadWorkflowFromClasspath(String classpath, ClassLoader cl, WorkflowFormat format, WorkflowReaderOperations reader) Reads a workflow from the classpath using the specified class loader, format, and custom reader.static io.serverlessworkflow.api.types.WorkflowreadWorkflowFromString(String input, WorkflowFormat format) Reads a workflow from a string using the specified format.static WorkflowReaderOperationsReturns aWorkflowReaderOperationsinstance that performs validation.
-
Method Details
-
readWorkflow
public static io.serverlessworkflow.api.types.Workflow readWorkflow(InputStream input, WorkflowFormat format) throws IOException Reads a workflow from anInputStreamusing the specified format.- Parameters:
input- the input stream containing the workflow definitionformat- the workflow format- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflow
public static io.serverlessworkflow.api.types.Workflow readWorkflow(Reader input, WorkflowFormat format) throws IOException Reads a workflow from aReaderusing the specified format.- Parameters:
input- the reader containing the workflow definitionformat- the workflow format- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflow
public static io.serverlessworkflow.api.types.Workflow readWorkflow(byte[] input, WorkflowFormat format) throws IOException Reads a workflow from a byte array using the specified format.- Parameters:
input- the byte array containing the workflow definitionformat- the workflow format- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflow
Reads a workflow from a file path, inferring the format from the file extension.- Parameters:
path- the path to the workflow file- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflow
public static io.serverlessworkflow.api.types.Workflow readWorkflow(Path path, WorkflowFormat format) throws IOException Reads a workflow from a file path using the specified format.- Parameters:
path- the path to the workflow fileformat- the workflow format- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflowFromString
public static io.serverlessworkflow.api.types.Workflow readWorkflowFromString(String input, WorkflowFormat format) throws IOException Reads a workflow from a string using the specified format.- Parameters:
input- the string containing the workflow definitionformat- the workflow format- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflowFromClasspath
public static io.serverlessworkflow.api.types.Workflow readWorkflowFromClasspath(String classpath) throws IOException Reads a workflow from the classpath, inferring the format from the file name.- Parameters:
classpath- the classpath location of the workflow file- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflowFromClasspath
public static io.serverlessworkflow.api.types.Workflow readWorkflowFromClasspath(String classpath, ClassLoader cl, WorkflowFormat format) throws IOException Reads a workflow from the classpath using the specified class loader and format.- Parameters:
classpath- the classpath location of the workflow filecl- the class loader to useformat- the workflow format- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflow
public static io.serverlessworkflow.api.types.Workflow readWorkflow(Path path, WorkflowReaderOperations reader) throws IOException Reads a workflow from a file path using a custom reader.- Parameters:
path- the path to the workflow filereader- the customWorkflowReaderOperations- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflow
public static io.serverlessworkflow.api.types.Workflow readWorkflow(Path path, WorkflowFormat format, WorkflowReaderOperations reader) throws IOException Reads a workflow from a file path using the specified format and custom reader.- Parameters:
path- the path to the workflow fileformat- the workflow formatreader- the customWorkflowReaderOperations- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflowFromClasspath
public static io.serverlessworkflow.api.types.Workflow readWorkflowFromClasspath(String classpath, WorkflowReaderOperations reader) throws IOException Reads a workflow from the classpath using a custom reader.- Parameters:
classpath- the classpath location of the workflow filereader- the customWorkflowReaderOperations- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs
-
readWorkflowFromClasspath
public static io.serverlessworkflow.api.types.Workflow readWorkflowFromClasspath(String classpath, ClassLoader cl, WorkflowFormat format, WorkflowReaderOperations reader) throws IOException Reads a workflow from the classpath using the specified class loader, format, and custom reader.- Parameters:
classpath- the classpath location of the workflow filecl- the class loader to useformat- the workflow formatreader- the customWorkflowReaderOperations- Returns:
- the parsed
Workflow - Throws:
IOException- if an I/O error occurs or the resource is not found
-
noValidation
Returns aWorkflowReaderOperationsinstance that performs no validation.- Returns:
- a no-validation reader
-
validation
Returns aWorkflowReaderOperationsinstance that performs validation.- Returns:
- a validation reader
-