Class Container

All Implemented Interfaces:
Documentable, PropertyHolder, Comparable<ModelItem>

public final class Container extends StaticStructureElement implements Documentable
Represents a "container" in the C4 model.
  • Method Details

    • getParent

      public Element getParent()
      Gets the parent software system.
      Specified by:
      getParent in class Element
      Returns:
      the parent SoftwareSystem instance
    • getSoftwareSystem

      public SoftwareSystem getSoftwareSystem()
      Gets the parent software system.
      Returns:
      the parent SoftwareSystem instance
    • getTechnology

      public String getTechnology()
      Gets the technology associated with this container (e.g. "Spring MVC application").
      Returns:
      the technology, as a String, or null if no technology has been specified
    • setTechnology

      public void setTechnology(String technology)
      Sets the technology associated with this container.
      Parameters:
      technology - the technology, as a String
    • addComponent

      public Component addComponent(String name)
      Adds a component to this container.
      Parameters:
      name - the name of the component
      Returns:
      the resulting Component instance
      Throws:
      IllegalArgumentException - if the component name is null or empty, or a component with the same name already exists
    • addComponent

      public Component addComponent(String name, String description)
      Adds a component to this container.
      Parameters:
      name - the name of the component
      description - a description of the component
      Returns:
      the resulting Component instance
      Throws:
      IllegalArgumentException - if the component name is null or empty, or a component with the same name already exists
    • addComponent

      public Component addComponent(String name, String description, String technology)
      Adds a component to this container.
      Parameters:
      name - the name of the component
      description - a description of the component
      technology - the technology of the component
      Returns:
      the resulting Component instance
      Throws:
      IllegalArgumentException - if the component name is null or empty, or a component with the same name already exists
    • getComponents

      public Set<Component> getComponents()
      Gets the set of components within this software system.
      Returns:
      a Set of Component objects
    • hasComponents

      public boolean hasComponents()
      Determines whether this container has any components.
      Returns:
      true if it has components, false otherwise
    • getComponentWithName

      public Component getComponentWithName(String name)
      Gets the component with the specified name.
      Parameters:
      name - the name of the component
      Returns:
      the Component instance, or null if a component with the specified name does not exist
      Throws:
      IllegalArgumentException - if the name is null or empty
    • getCanonicalName

      public String getCanonicalName()
      Gets the canonical name of this container, in the form "/Software System/Container".
      Specified by:
      getCanonicalName in class ModelItem
      Returns:
      the canonical name, as a String
    • getDefaultTags

      public Set<String> getDefaultTags()
      Specified by:
      getDefaultTags in class ModelItem
    • getDocumentation

      public Documentation getDocumentation()
      Gets the documentation associated with this container.
      Specified by:
      getDocumentation in interface Documentable
      Returns:
      a Documentation object