Class Component

All Implemented Interfaces:
PropertyHolder

public final class Component extends StaticStructureElement
Represents a "component" in the C4 model.
  • Method Details

    • getParent

      public Element getParent()
      Description copied from class: Element
      Gets the parent of this element.
      Specified by:
      getParent in class Element
      Returns:
      the parent Element, or null if this element doesn't have a parent (i.e. a Person or SoftwareSystem)
    • getContainer

      public Container getContainer()
    • getTechnology

      public String getTechnology()
      Gets the technology associated with this component (e.g. "Spring Bean").
      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 component (e.g. "Spring Bean").
      Parameters:
      technology - the technology, as a String
    • getType

      public CodeElement getType()
      Gets the type of this component (e.g. a fully qualified Java interface/class name).
      Returns:
      the type, as a String
    • setType

      public CodeElement setType(String type)
      Sets the type of this component (e.g. a fully qualified Java interface/class name).
      Parameters:
      type - the fully qualified type name
      Returns:
      the CodeElement that was created
      Throws:
      IllegalArgumentException - if the specified type is null
    • getCode

      public Set<CodeElement> getCode()
      Gets the set of CodeElement objects.
      Returns:
      a Set, which could be empty
    • addSupportingType

      public CodeElement addSupportingType(String type)
      Adds a supporting type to this Component.
      Parameters:
      type - the fully qualified type name
      Returns:
      a CodeElement representing the supporting type
      Throws:
      IllegalArgumentException - if the specified type is null
    • getSize

      public long getSize()
      Gets the size of this Component (e.g. number of lines).
      Returns:
      the size of this component, as a long
    • setSize

      public void setSize(long size)
      Sets the size of this component (e.g. number of lines).
      Parameters:
      size - the size
    • getCanonicalName

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

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