Package com.structurizr.model
Class Relationship
java.lang.Object
com.structurizr.model.Relationship
public final class Relationship
extends java.lang.Object
A relationship between two elements.
-
Method Summary
Modifier and Type Method Description PerspectiveaddPerspective(java.lang.String name, java.lang.String description)Adds a perspective to this model item.voidaddProperty(java.lang.String name, java.lang.String value)Adds a name-value pair property to this element.voidaddTags(java.lang.String... tags)java.lang.StringgetDescription()ElementgetDestination()java.lang.StringgetDestinationId()Gets the ID of the destination element.java.lang.StringgetId()Gets the ID of this item in the model.InteractionStylegetInteractionStyle()Gets the interaction style (synchronous or asynchronous).java.lang.StringgetLinkedRelationshipId()java.util.Set<Perspective>getPerspectives()Gets the set of perspectives associated with this model item.java.util.Map<java.lang.String,java.lang.String>getProperties()Gets the collection of name-value property pairs associated with this element, as a Map.protected java.util.Set<java.lang.String>getRequiredTags()ElementgetSource()java.lang.StringgetSourceId()Gets the ID of the source element.java.lang.StringgetTags()Gets the comma separated list of tags.java.util.Set<java.lang.String>getTagsAsSet()java.lang.StringgetTechnology()Gets the technology associated with this relationship (e.g.java.lang.StringgetUrl()Gets the URL where more information about this relationship can be found.booleanhasTag(java.lang.String tag)Determines whether this model item has the given tag.booleanremoveTag(java.lang.String tag)Removes the given tag.voidsetUrl(java.lang.String url)Sets the URL where more information about this relationship can be found.java.lang.StringtoString()
-
Method Details
-
getSource
-
getSourceId
public java.lang.String getSourceId()Gets the ID of the source element.- Returns:
- the ID of the source element, as a String
-
getDestination
-
getDestinationId
public java.lang.String getDestinationId()Gets the ID of the destination element.- Returns:
- the ID of the destination element, as a String
-
getDescription
public java.lang.String getDescription() -
getTechnology
public java.lang.String getTechnology()Gets the technology associated with this relationship (e.g. HTTPS, JDBC, etc).- Returns:
- the technology as a String, or null if a technology is not specified
-
getInteractionStyle
Gets the interaction style (synchronous or asynchronous).- Returns:
- an InteractionStyle, or null if an interaction style has not been specified
-
getLinkedRelationshipId
public java.lang.String getLinkedRelationshipId() -
getRequiredTags
protected java.util.Set<java.lang.String> getRequiredTags() -
getUrl
public java.lang.String getUrl()Gets the URL where more information about this relationship can be found.- Returns:
- a URL as a String
-
setUrl
public void setUrl(java.lang.String url)Sets the URL where more information about this relationship can be found.- Parameters:
url- the URL as a String- Throws:
java.lang.IllegalArgumentException- if the URL is not a well-formed URL
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getId
public java.lang.String getId()Gets the ID of this item in the model.- Returns:
- the ID, as a String
-
getTags
public java.lang.String getTags()Gets the comma separated list of tags.- Returns:
- a comma separated list of tags, or an empty string if there are no tags
-
getTagsAsSet
public java.util.Set<java.lang.String> getTagsAsSet() -
addTags
public void addTags(java.lang.String... tags) -
removeTag
public boolean removeTag(java.lang.String tag)Removes the given tag.- Parameters:
tag- the tag to remove- Returns:
- true if the tag was removed; will return false if a non-existent tag is passed, or if an attempt is made to remove required tags, which cannot be removed.
-
hasTag
public boolean hasTag(java.lang.String tag)Determines whether this model item has the given tag.- Parameters:
tag- the tag to check for- Returns:
- true if tag is present as a tag on this item, or if it is one of the required tags defined by the model in getRequiredTags(), false otherwise
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()Gets the collection of name-value property pairs associated with this element, as a Map.- Returns:
- a Map (String, String) (empty if there are no properties)
-
addProperty
public void addProperty(java.lang.String name, java.lang.String value)Adds a name-value pair property to this element.- Parameters:
name- the name of the propertyvalue- the value of the property
-
getPerspectives
Gets the set of perspectives associated with this model item.- Returns:
- a Set of Perspective objects (empty if there are none)
-
addPerspective
Adds a perspective to this model item.- Parameters:
name- the name of the perspective (e.g. "Security", must be unique)description- a description of the perspective- Returns:
- a Perspective object
- Throws:
java.lang.IllegalArgumentException- if perspective details are not specified, or the named perspective exists already
-