From ff7484b24b6514a2c4c375d1f6b4f85a145eef71 Mon Sep 17 00:00:00 2001 From: Michael Hunger Date: Mon, 4 Apr 2011 10:34:28 +0200 Subject: [PATCH] updated interface documentation, added getRelationshipId() to RelationshipBacked interface --- .../springframework/data/graph/core/NodeBacked.java | 12 +++++++++--- .../data/graph/core/RelationshipBacked.java | 8 +++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/graph/core/NodeBacked.java b/spring-data-neo4j/src/main/java/org/springframework/data/graph/core/NodeBacked.java index f8872e53a..1c072980a 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/graph/core/NodeBacked.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/graph/core/NodeBacked.java @@ -50,7 +50,7 @@ public interface NodeBacked extends GraphBacked { * public class Person { * ... * public Friendship knows(Person p) { - * return (Friendship) relateTo(p, Friendship.class, "knows"); + * return relateTo(p, Friendship.class, "knows"); * } * ... * } @@ -75,8 +75,6 @@ public interface NodeBacked extends GraphBacked { /** - * Get the ID of the entity. - * * @return underlying node ID, or null if there is no underlying node */ Long getNodeId(); @@ -122,6 +120,14 @@ public interface NodeBacked extends GraphBacked { + /** + * Finds the relationship of the specified type, from this entity's underlying node to the target entity's + * underlying node. + * + * @param target end node of relationship + * @param type type of the sought relationship + * @return requested relationship if it was found, null otherwise + */ Relationship getRelationshipTo(NodeBacked target, String type); /** diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/graph/core/RelationshipBacked.java b/spring-data-neo4j/src/main/java/org/springframework/data/graph/core/RelationshipBacked.java index 0749c2acb..5763965b9 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/graph/core/RelationshipBacked.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/graph/core/RelationshipBacked.java @@ -31,11 +31,17 @@ public interface RelationshipBacked extends GraphBacked{ /** - * Reify this relationship entity as another relationship backed type. The same underlying relationship will be + * Project this relationship entity as another relationship backed type. The same underlying relationship will be * used for the new entity. * * @param targetType type to project to * @return new instance of specified type, sharing the same underlying relationship with this entity */ R projectTo(Class targetType); + + + /** + * @return the id of the underlying relationship or null if there is none + */ + Long getRelationshipId(); }