Class WorkflowReader

java.lang.Object
io.serverlessworkflow.api.WorkflowReader

public class WorkflowReader extends Object
Utility class for reading and parsing Serverless Workflow definitions from various sources.
  • Method Details

    • readWorkflow

      public static io.serverlessworkflow.api.types.Workflow readWorkflow(InputStream input, WorkflowFormat format) throws IOException
      Reads a workflow from an InputStream using the specified format.
      Parameters:
      input - the input stream containing the workflow definition
      format - 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 a Reader using the specified format.
      Parameters:
      input - the reader containing the workflow definition
      format - 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 definition
      format - 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) throws IOException
      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 file
      format - 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 definition
      format - 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 file
      cl - the class loader to use
      format - 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 file
      reader - the custom WorkflowReaderOperations
      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 file
      format - the workflow format
      reader - the custom WorkflowReaderOperations
      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 file
      reader - the custom WorkflowReaderOperations
      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 file
      cl - the class loader to use
      format - the workflow format
      reader - the custom WorkflowReaderOperations
      Returns:
      the parsed Workflow
      Throws:
      IOException - if an I/O error occurs or the resource is not found
    • noValidation

      public static WorkflowReaderOperations noValidation()
      Returns a WorkflowReaderOperations instance that performs no validation.
      Returns:
      a no-validation reader
    • validation

      public static WorkflowReaderOperations validation()
      Returns a WorkflowReaderOperations instance that performs validation.
      Returns:
      a validation reader