Enum Class WorkflowFormat

java.lang.Object
java.lang.Enum<WorkflowFormat>
io.serverlessworkflow.api.WorkflowFormat
All Implemented Interfaces:
Serializable, Comparable<WorkflowFormat>, Constable

public enum WorkflowFormat extends Enum<WorkflowFormat>
Enum representing the supported formats for Serverless Workflow definitions.

Provides utility methods to determine the format based on file name or path, and to access the corresponding ObjectMapper for serialization and deserialization.

  • Enum Constant Details

    • JSON

      public static final WorkflowFormat JSON
      JSON format for workflow definitions.
    • YAML

      public static final WorkflowFormat YAML
      YAML format for workflow definitions.
  • Method Details

    • values

      public static WorkflowFormat[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static WorkflowFormat valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromPath

      public static WorkflowFormat fromPath(Path path)
      Determines the WorkflowFormat from a file path by inspecting its file extension.
      Parameters:
      path - the file path to inspect
      Returns:
      the corresponding WorkflowFormat
    • fromFileName

      public static WorkflowFormat fromFileName(String fileName)
      Determines the WorkflowFormat from a file name by inspecting its extension. Returns JSON if the file name ends with ".json", otherwise returns YAML.
      Parameters:
      fileName - the file name to inspect
      Returns:
      the corresponding WorkflowFormat
    • mapper

      public com.fasterxml.jackson.databind.ObjectMapper mapper()
      Returns the ObjectMapper associated with this workflow format.
      Returns:
      the object mapper for this format