Class Element

java.lang.Object
com.structurizr.model.ModelItem
com.structurizr.model.Element
All Implemented Interfaces:
PropertyHolder, Comparable<ModelItem>
Direct Known Subclasses:
GroupableElement

public abstract class Element extends ModelItem
This is the superclass for all model elements.
  • Constructor Details

    • Element

      protected Element()
  • Method Details

    • getModel

      public Model getModel()
    • setModel

      protected void setModel(Model model)
    • getName

      public String getName()
      Gets the name of this element.
      Returns:
      the name, as a String
    • getDescription

      public String getDescription()
      Gets a description of this element.
      Returns:
      the description, as a String
    • setDescription

      public void setDescription(String description)
      Sets the description of this element.
      Parameters:
      description - the description, as a String
    • getParent

      public abstract Element getParent()
      Gets the parent of this element.
      Returns:
      the parent Element, or null if this element doesn't have a parent (i.e. a Person or SoftwareSystem)
    • getRelationships

      public Set<Relationship> getRelationships()
      Gets the set of outgoing relationships.
      Returns:
      a Set of Relationship objects, or an empty set if none exist
    • hasAfferentRelationships

      public boolean hasAfferentRelationships()
      Determines whether this element has afferent (incoming) relationships.
      Returns:
      true if this element has afferent relationships, false otherwise
    • hasEfferentRelationshipWith

      public boolean hasEfferentRelationshipWith(Element element)
      Determines whether this element has an efferent (outgoing) relationship with the specified element.
      Parameters:
      element - the element to look for
      Returns:
      true if this element has an efferent relationship with the specified element, false otherwise
    • hasEfferentRelationshipWith

      public boolean hasEfferentRelationshipWith(Element element, String description)
      Determines whether this element has an efferent (outgoing) relationship with the specified element and description.
      Parameters:
      element - the element to look for
      description - the relationship description
      Returns:
      true if this element has an efferent relationship with the specified element and description, false otherwise
    • getEfferentRelationshipWith

      public Relationship getEfferentRelationshipWith(Element element)
      Gets the efferent (outgoing) relationship with the specified element.
      Parameters:
      element - the element to look for
      Returns:
      a Relationship object if an efferent relationship exists, null otherwise
    • getEfferentRelationshipsWith

      public Set<Relationship> getEfferentRelationshipsWith(Element element)
      Gets the efferent (outgoing) relationship with the specified element.
      Parameters:
      element - the element to look for
      Returns:
      a Set of Relationship objects; empty if no relationships exist
    • getEfferentRelationshipWith

      public Relationship getEfferentRelationshipWith(Element element, String description)
      Gets the efferent (outgoing) relationship with the specified element and description.
      Parameters:
      element - the element to look for
      description - the relationship description
      Returns:
      a Relationship object, or null if the specified relationship doesn't exist
    • uses

      @Nullable public Relationship uses(@Nonnull CustomElement destination, String description)
      Adds a unidirectional "uses" style relationship between this element and the specified custom element.
      Parameters:
      destination - the target of the relationship
      description - a description of the relationship (e.g. "uses", "gets data from", "sends data to")
      Returns:
      the relationship that has just been created and added to the model
    • uses

      @Nullable public Relationship uses(@Nonnull CustomElement destination, String description, String technology)
      Adds a unidirectional "uses" style relationship between this element and the specified custom element.
      Parameters:
      destination - the target of the relationship
      description - a description of the relationship (e.g. "uses", "gets data from", "sends data to")
      technology - the technology details (e.g. JSON/HTTPS)
      Returns:
      the relationship that has just been created and added to the model
    • uses

      @Nullable public Relationship uses(@Nonnull CustomElement destination, String description, String technology, InteractionStyle interactionStyle, String[] tags)
      Adds a unidirectional "uses" style relationship between this element and the specified custom element.
      Parameters:
      destination - the target of the relationship
      description - a description of the relationship (e.g. "uses", "gets data from", "sends data to")
      technology - the technology details (e.g. JSON/HTTPS)
      interactionStyle - the interaction style (sync vs async)
      tags - an array of tags
      Returns:
      the relationship that has just been created and added to the model
    • toString

      public String toString()
      Overrides:
      toString in class Object