Class ThemeUtils


  • public final class ThemeUtils
    extends java.lang.Object
    Some utility methods for exporting themes to JSON.
    • Constructor Summary

      Constructors 
      Constructor Description
      ThemeUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void loadThemes​(com.structurizr.Workspace workspace)
      Loads (and inlines) the element and relationship styles from the themes defined in the workspace, into the workspace itself.
      static java.lang.String toJson​(com.structurizr.Workspace workspace)
      Serializes the theme (element and relationship styles) in the specified workspace to a JSON string.
      static void toJson​(com.structurizr.Workspace workspace, java.io.File file)
      Serializes the theme (element and relationship styles) in the specified workspace to a file, as a JSON string.
      • Methods inherited from class java.lang.Object

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

      • ThemeUtils

        public ThemeUtils()
    • Method Detail

      • toJson

        public static void toJson​(com.structurizr.Workspace workspace,
                                  java.io.File file)
                           throws java.lang.Exception
        Serializes the theme (element and relationship styles) in the specified workspace to a file, as a JSON string.
        Parameters:
        workspace - a Workspace object
        file - a File representing the JSON definition
        Throws:
        java.lang.Exception - if something goes wrong
      • toJson

        public static java.lang.String toJson​(com.structurizr.Workspace workspace)
                                       throws java.lang.Exception
        Serializes the theme (element and relationship styles) in the specified workspace to a JSON string.
        Parameters:
        workspace - a Workspace instance
        Returns:
        a JSON string
        Throws:
        java.lang.Exception - if something goes wrong
      • loadThemes

        public static void loadThemes​(com.structurizr.Workspace workspace)
                               throws java.lang.Exception
        Loads (and inlines) the element and relationship styles from the themes defined in the workspace, into the workspace itself. This implementation simply copies the styles from all themes into the workspace.
        Parameters:
        workspace - a Workspace object
        Throws:
        java.lang.Exception - if something goes wrong