Package com.structurizr.model
Class Element
java.lang.Object
com.structurizr.model.ModelItem
com.structurizr.model.Element
- Direct Known Subclasses:
DeploymentElement
,GroupableElement
public abstract class Element extends ModelItem
This is the superclass for all model elements.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Element()
-
Method Summary
Modifier and Type Method Description java.lang.String
getDescription()
Gets a description of this element.java.util.Set<Relationship>
getEfferentRelationshipsWith(Element element)
Gets the efferent (outgoing) relationship with the specified element.Relationship
getEfferentRelationshipWith(Element element)
Gets the efferent (outgoing) relationship with the specified element.Relationship
getEfferentRelationshipWith(Element element, java.lang.String description)
Gets the efferent (outgoing) relationship with the specified element and description.Model
getModel()
java.lang.String
getName()
Gets the name of this element.abstract Element
getParent()
Gets the parent of this element.java.util.Set<Relationship>
getRelationships()
Gets the set of outgoing relationships.boolean
hasAfferentRelationships()
Determines whether this element has afferent (incoming) relationships.boolean
hasEfferentRelationshipWith(Element element)
Determines whether this element has an efferent (outgoing) relationship with the specified element.boolean
hasEfferentRelationshipWith(Element element, java.lang.String description)
Determines whether this element has an efferent (outgoing) relationship with the specified element and description.void
setDescription(java.lang.String description)
Sets the description of this element.protected void
setModel(Model model)
java.lang.String
toString()
Relationship
uses(CustomElement destination, java.lang.String description)
Adds a unidirectional "uses" style relationship between this element and the specified custom element.Relationship
uses(CustomElement destination, java.lang.String description, java.lang.String technology)
Adds a unidirectional "uses" style relationship between this element and the specified custom element.Relationship
uses(CustomElement destination, java.lang.String description, java.lang.String technology, InteractionStyle interactionStyle, java.lang.String[] tags)
Adds a unidirectional "uses" style relationship between this element and the specified custom element.Methods inherited from class com.structurizr.model.ModelItem
addPerspective, addProperty, addTags, getCanonicalName, getId, getOriginId, getPerspectives, getProperties, getRequiredTags, getTags, getTagsAsSet, getUrl, hasTag, removeTag, setUrl
-
Constructor Details
-
Element
protected Element()
-
-
Method Details
-
getModel
-
setModel
-
getName
public java.lang.String getName()Gets the name of this element.- Returns:
- the name, as a String
-
getDescription
public java.lang.String getDescription()Gets a description of this element.- Returns:
- the description, as a String
-
setDescription
public void setDescription(java.lang.String description)Sets the description of this element.- Parameters:
description
- the description, as a String
-
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
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
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
Determines whether this element has an efferent (outgoing) relationship with the specified element and description.- Parameters:
element
- the element to look fordescription
- the relationship description- Returns:
- true if this element has an efferent relationship with the specified element and description, false otherwise
-
getEfferentRelationshipWith
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
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
Gets the efferent (outgoing) relationship with the specified element and description.- Parameters:
element
- the element to look fordescription
- the relationship description- Returns:
- a Relationship object, or null if the specified relationship doesn't exist
-
uses
@Nullable public Relationship uses(@Nonnull CustomElement destination, java.lang.String description)Adds a unidirectional "uses" style relationship between this element and the specified custom element.- Parameters:
destination
- the target of the relationshipdescription
- 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, java.lang.String description, java.lang.String technology)Adds a unidirectional "uses" style relationship between this element and the specified custom element.- Parameters:
destination
- the target of the relationshipdescription
- 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, java.lang.String description, java.lang.String technology, InteractionStyle interactionStyle, java.lang.String[] tags)Adds a unidirectional "uses" style relationship between this element and the specified custom element.- Parameters:
destination
- the target of the relationshipdescription
- 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 java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-