Class StructurizrDslParser

java.lang.Object
com.structurizr.dsl.StructurizrDslParser

public final class StructurizrDslParser extends Object
Main DSL parser class - forms the API for using the parser.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of the parser.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the identifier register in use (this is the mapping of DSL identifiers to elements/relationships).
    com.structurizr.Workspace
    Gets the workspace that has been created by parsing the Structurizr DSL.
    void
    parse(File path)
    Parses the specified Structurizr DSL file(s), adding the parsed content to the workspace.
    void
    Parses the specified Structurizr DSL fragment, adding the parsed content to the workspace.
    void
    setRestricted(boolean restricted)
    Sets whether to run this parser in restricted mode (this stops !include, !docs, !adrs from working).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StructurizrDslParser

      public StructurizrDslParser()
      Creates a new instance of the parser.
  • Method Details

    • setRestricted

      public void setRestricted(boolean restricted)
      Sets whether to run this parser in restricted mode (this stops !include, !docs, !adrs from working).
      Parameters:
      restricted - true for restricted mode, false otherwise
    • getWorkspace

      public com.structurizr.Workspace getWorkspace()
      Gets the workspace that has been created by parsing the Structurizr DSL.
      Returns:
      a Workspace instance
    • parse

      public void parse(File path) throws StructurizrDslParserException
      Parses the specified Structurizr DSL file(s), adding the parsed content to the workspace. If "path" represents a single file, that single file will be parsed. If "path" represents a directory, all files in that directory (recursively) will be parsed.
      Parameters:
      path - a File object representing a file or directory
      Throws:
      StructurizrDslParserException - when something goes wrong
    • parse

      public void parse(String dsl) throws StructurizrDslParserException
      Parses the specified Structurizr DSL fragment, adding the parsed content to the workspace.
      Parameters:
      dsl - a DSL fragment
      Throws:
      StructurizrDslParserException - when something goes wrong
    • getIdentifiersRegister

      public IdentifiersRegister getIdentifiersRegister()
      Gets the identifier register in use (this is the mapping of DSL identifiers to elements/relationships).
      Returns:
      an IdentifiersRegister object