Class ProcessContext

java.lang.Object
ru.yojo.codegen.context.ProcessContext

public class ProcessContext extends Object
Holds contextual data for a single AsyncAPI specification processing session. Includes parsed content, configuration, and intermediate state (e.g., resolved schemas/messages).
  • Constructor Details

    • ProcessContext

      public ProcessContext(Map<String,Object> content)
      Constructs a new context with the raw parsed YAML content.
      Parameters:
      content - root AsyncAPI document as a Map (e.g., from SnakeYAML)
  • Method Details

    • isExperimental

      public boolean isExperimental()
    • setExperimental

      public void setExperimental(boolean experimental)
    • getHelper

      public Helper getHelper()
      Returns the shared helper instance.
      Returns:
      non-null Helper
    • setHelper

      public void setHelper(Helper helper)
      Sets the shared helper instance.
      Parameters:
      helper - helper to use (must not be null)
    • getSpringBootVersion

      public String getSpringBootVersion()
      Returns the Spring Boot version string (e.g., "3.x.x"). Used to select correct validation annotation packages (jakarta vs javax).
      Returns:
      Spring Boot version or null if unspecified
    • setSpringBootVersion

      public void setSpringBootVersion(String springBootVersion)
      Sets the Spring Boot version.
      Parameters:
      springBootVersion - version string (e.g., "3.x.x")
    • getContent

      public Map<String,Object> getContent()
      Returns the full parsed AsyncAPI document.
      Returns:
      root YAML content as a Map
    • getFilePath

      public String getFilePath()
      Returns the absolute path to the input specification file.
      Returns:
      file path or null if not set
    • setFilePath

      public void setFilePath(String filePath)
      Sets the absolute path to the input specification file.
      Parameters:
      filePath - absolute path to YAML file
    • getOutputDirectory

      public String getOutputDirectory()
      Returns the base output directory (without subdirectories like /messages).
      Returns:
      base output path
    • setOutputDirectory

      public void setOutputDirectory(String outputDirectory)
      Sets the base output directory.
      Parameters:
      outputDirectory - directory path (e.g., "src/gen/java/")
    • getPackageLocation

      public String getPackageLocation()
      Returns the base Java package (without .messages or .common).
      Returns:
      package (e.g., "com.example.api")
    • setPackageLocation

      public void setPackageLocation(String packageLocation)
      Sets the base Java package.
      Parameters:
      packageLocation - base package name
    • getLombokProperties

      public LombokProperties getLombokProperties()
      Returns the effective Lombok configuration.
      Returns:
      lombok properties
    • setLombokProperties

      public void setLombokProperties(LombokProperties lombokProperties)
      Sets the Lombok configuration to use for generated classes.
      Parameters:
      lombokProperties - lombok config
    • getPathToWrite

      public String getPathToWrite()
      Returns the final output directory where files will be written (e.g., ".../common/").
      Returns:
      absolute path to target directory
    • setPathToWrite

      public void setPathToWrite(String pathToWrite)
      Sets the final output directory and ensures it exists.

      Does NOT append /messages or /common — the caller must provide the full path.

      Parameters:
      pathToWrite - absolute directory path; if null, no-op
    • getMessagePackage

      public String getMessagePackage()
      Returns the package for message classes (e.g., "com.example.api.messages;").

      If unset, returns packageLocation + ".messages;".

      Returns:
      message package with trailing semicolon
    • setMessagePackage

      public void setMessagePackage(String messagePackage)
      Sets the package for message classes.
      Parameters:
      messagePackage - full package, e.g., "com.example.api.messages;"
    • getCommonPackage

      public String getCommonPackage()
      Returns the package for schema (DTO/enums) classes (e.g., "com.example.api.common;").

      If unset, returns packageLocation + ".common;".

      Returns:
      schema package with trailing semicolon
    • setCommonPackage

      public void setCommonPackage(String commonPackage)
      Sets the package for schema (DTO/enums) classes.
      Parameters:
      commonPackage - full package, e.g., "com.example.api.common;"
    • setJsonPropertyDescription

      public void setJsonPropertyDescription(boolean jsonPropertyDescription)
      Enables or disables @JsonPropertyDescription generation.
      Parameters:
      jsonPropertyDescription - true to generate annotation
    • isJsonPropertyDescription

      public boolean isJsonPropertyDescription()
      Returns whether @JsonPropertyDescription should be generated.
      Returns:
      true if enabled
    • getMessagesMap

      public Map<String,Object> getMessagesMap()
      Returns the map of all message definitions (from components.messages).
      Returns:
      messages map (schema name → definition)
    • setMessagesMap

      public void setMessagesMap(Map<String,Object> messagesMap)
      Sets the map of message definitions.
      Parameters:
      messagesMap - messages map
    • getSchemasMap

      public Map<String,Object> getSchemasMap()
      Returns the map of all schema definitions (from components.schemas).
      Returns:
      schemas map (schema name → definition)
    • setSchemasMap

      public void setSchemasMap(Map<String,Object> schemasMap)
      Sets the map of schema definitions.
      Parameters:
      schemasMap - schemas map