Package com.adobe.granite.socialgraph
Interface Relationship
-
- All Superinterfaces:
java.util.Map<java.lang.String,java.lang.Object>
@ProviderType public interface Relationship extends java.util.Map<java.lang.String,java.lang.Object>
Relationship
specifies an edge in the social graph and represents the relationship between two graph nodes (users, groups, topics).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
delete()
Deletes this relationship.<T> T
get(java.lang.String name, java.lang.Class<T> type)
Get a named property and convert it into the given type.<T> T
get(java.lang.String name, T defaultValue)
Get a named property and convert it into the given type.GraphNode
getEndNode()
Returns the ending node of this relationshipGraphNode
getOtherNode(GraphNode node)
A convenience operation that, given a node that is attached to this relationship, returns the other node.GraphNode
getStartNode()
Returns the starting node of this relationshipjava.lang.String
getType()
Returns the type of this relationship.boolean
isBidirectional()
Convenience operation that checks if this relationship is also established in the other direction.boolean
isVirtual()
Specifies tha this relationship is virtual and is not (and will never be) backed by a persistence object.java.lang.String
signature()
Returns a signature of the relationship of the form:startNodeId ":" type ":" endNodeId
, with the ids and type url encoded.
-
-
-
Method Detail
-
getStartNode
GraphNode getStartNode()
Returns the starting node of this relationship- Returns:
- the starting node of this relationship
-
getEndNode
GraphNode getEndNode()
Returns the ending node of this relationship- Returns:
- the ending node of this relationship
-
getOtherNode
GraphNode getOtherNode(GraphNode node)
A convenience operation that, given a node that is attached to this relationship, returns the other node.- Parameters:
node
- the start or end node of this relationship- Returns:
- the other node
-
isBidirectional
boolean isBidirectional()
Convenience operation that checks if this relationship is also established in the other direction.- Returns:
true
if this relationship is bidirectional.
-
getType
java.lang.String getType()
Returns the type of this relationship.- Returns:
- the type of this relationship
-
isVirtual
boolean isVirtual()
Specifies tha this relationship is virtual and is not (and will never be) backed by a persistence object.- Returns:
true
if this node is virtual.
-
delete
void delete()
Deletes this relationship.
-
signature
java.lang.String signature()
Returns a signature of the relationship of the form:startNodeId ":" type ":" endNodeId
, with the ids and type url encoded. the equals and hash methods should use this signature for equality check.- Returns:
- the signature
-
get
<T> T get(java.lang.String name, java.lang.Class<T> type)
Get a named property and convert it into the given type.- Type Parameters:
T
- the type- Parameters:
name
- The name of the propertytype
- The class of the type- Returns:
- Return named value converted to type T or
null
if non existing or can't be converted.
-
get
<T> T get(java.lang.String name, T defaultValue)
Get a named property and convert it into the given type.- Type Parameters:
T
- the type- Parameters:
name
- The name of the propertydefaultValue
- The default value to use if the named property does not exist or cannot be converted to the requested type. The default value is also used to define the type to convert the value to. If this isnull
any existing property is not converted.- Returns:
- Return named value converted to type T or the default value if non existing or can't be converted.
-
-