Class DocumentationTemplate

java.lang.Object
com.structurizr.documentation.DocumentationTemplate
Direct Known Subclasses:
Arc42DocumentationTemplate, AutomaticDocumentationTemplate, StructurizrDocumentationTemplate, ViewpointsAndPerspectivesDocumentationTemplate

public abstract class DocumentationTemplate
extends java.lang.Object
The superclass for all documentation templates.
  • Constructor Summary

    Constructors 
    Constructor Description
    DocumentationTemplate​(Workspace workspace)
    Creates a new documentation template for the given workspace.
  • Method Summary

    Modifier and Type Method Description
    Image addImage​(java.io.File file)
    Adds an image from the given file to the workspace.
    java.util.Collection<Image> addImages​(java.io.File path)
    Adds png/jpg/jpeg/gif images in the given directory to the workspace.
    Section addSection​(Component component, java.lang.String title, Format format, java.lang.String content)
    Adds a section relating to a Component.
    Section addSection​(Component component, java.lang.String title, java.io.File... files)
    Adds a section relating to a Component from one or more files.
    Section addSection​(Container container, java.lang.String title, Format format, java.lang.String content)
    Adds a section relating to a Container.
    Section addSection​(Container container, java.lang.String title, java.io.File... files)
    Adds a section relating to a Container from one or more files.
    Section addSection​(SoftwareSystem softwareSystem, java.lang.String title, Format format, java.lang.String content)
    Adds a section relating to a SoftwareSystem.
    Section addSection​(SoftwareSystem softwareSystem, java.lang.String title, java.io.File... files)
    Adds a section relating to a SoftwareSystem from one or more files.
    Section addSection​(java.lang.String title, Format format, java.lang.String content)
    Adds a custom section, that isn't related to any element in the model.
    Section addSection​(java.lang.String title, java.io.File... files)
    Adds a custom section from one or more files, that isn't related to any element in the model.
    protected abstract TemplateMetadata getMetadata()
    Gets the metadata associated with this template.

    Methods inherited from class java.lang.Object

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

    • DocumentationTemplate

      public DocumentationTemplate​(@Nonnull Workspace workspace)
      Creates a new documentation template for the given workspace.
      Parameters:
      workspace - the Workspace instance to create documentation for
  • Method Details

    • addSection

      public Section addSection​(java.lang.String title, java.io.File... files) throws java.io.IOException
      Adds a custom section from one or more files, that isn't related to any element in the model.
      Parameters:
      title - the section title
      files - one or more File objects that point to the documentation content
      Returns:
      a documentation Section
      Throws:
      java.io.IOException - if there is an error reading the files
    • addSection

      @Nonnull public Section addSection​(java.lang.String title, Format format, java.lang.String content)
      Adds a custom section, that isn't related to any element in the model.
      Parameters:
      title - the section title
      format - the Format of the documentation content
      content - a String containing the documentation content
      Returns:
      a documentation Section
    • addSection

      @Nonnull public Section addSection​(SoftwareSystem softwareSystem, java.lang.String title, java.io.File... files) throws java.io.IOException
      Adds a section relating to a SoftwareSystem from one or more files.
      Parameters:
      softwareSystem - the SoftwareSystem the documentation content relates to
      title - the section title
      files - one or more File objects that point to the documentation content
      Returns:
      a documentation Section
      Throws:
      java.io.IOException - if there is an error reading the files
    • addSection

      public Section addSection​(SoftwareSystem softwareSystem, java.lang.String title, Format format, java.lang.String content)
      Adds a section relating to a SoftwareSystem.
      Parameters:
      softwareSystem - the SoftwareSystem the documentation content relates to
      title - the section title
      format - the Format of the documentation content
      content - a String containing the documentation content
      Returns:
      a documentation Section
    • addSection

      public Section addSection​(Container container, java.lang.String title, java.io.File... files) throws java.io.IOException
      Adds a section relating to a Container from one or more files.
      Parameters:
      container - the Container the documentation content relates to
      title - the section title
      files - one or more File objects that point to the documentation content
      Returns:
      a documentation Section
      Throws:
      java.io.IOException - if there is an error reading the files
    • addSection

      public Section addSection​(Container container, java.lang.String title, Format format, java.lang.String content)
      Adds a section relating to a Container.
      Parameters:
      container - the Container the documentation content relates to
      title - the section title
      format - the Format of the documentation content
      content - a String containing the documentation content
      Returns:
      a documentation Section
    • addSection

      public Section addSection​(Component component, java.lang.String title, java.io.File... files) throws java.io.IOException
      Adds a section relating to a Component from one or more files.
      Parameters:
      component - the Component the documentation content relates to
      title - the section title
      files - one or more File objects that point to the documentation content
      Returns:
      a documentation Section
      Throws:
      java.io.IOException - if there is an error reading the files
    • addSection

      public Section addSection​(Component component, java.lang.String title, Format format, java.lang.String content)
      Adds a section relating to a Component.
      Parameters:
      component - the Component the documentation content relates to
      title - the section title
      format - the Format of the documentation content
      content - a String containing the documentation content
      Returns:
      a documentation Section
    • addImages

      public java.util.Collection<Image> addImages​(java.io.File path) throws java.io.IOException
      Adds png/jpg/jpeg/gif images in the given directory to the workspace.
      Parameters:
      path - a File descriptor representing a directory on disk
      Returns:
      a Collection of Image objects
      Throws:
      java.io.IOException - if the path can't be accessed
    • addImage

      public Image addImage​(java.io.File file) throws java.io.IOException
      Adds an image from the given file to the workspace.
      Parameters:
      file - a File descriptor representing an image file on disk
      Returns:
      an Image object representing the image added
      Throws:
      java.io.IOException - if there is an error reading the image
    • getMetadata

      protected abstract TemplateMetadata getMetadata()
      Gets the metadata associated with this template.
      Returns:
      a TemplateMetadata object, or null if there is none