cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [1/2] cayenne git commit: CAY-2030 Capturing a stream of commit changes
Date Mon, 12 Oct 2015 18:44:58 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 58c7c3b37 -> 3a412a4aa


CAY-2030 Capturing a stream of commit changes

API usability improvements: visitor returning value


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/3a412a4a
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/3a412a4a
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/3a412a4a

Branch: refs/heads/master
Commit: 3a412a4aadd9e2ac8d341fb8ce3ce91deedcc631
Parents: e00a641
Author: Andrus Adamchik <andrus@objectstyle.com>
Authored: Mon Oct 12 13:06:40 2015 -0400
Committer: aadamchik <aadamchik@apache.org>
Committed: Mon Oct 12 14:42:25 2015 -0400

----------------------------------------------------------------------
 .../cayenne/lifecycle/changemap/MutableAttributeChange.java  | 4 ++--
 .../lifecycle/changemap/MutableToManyRelationshipChange.java | 6 +++---
 .../lifecycle/changemap/MutableToOneRelationshipChange.java  | 4 ++--
 .../apache/cayenne/lifecycle/changemap/PropertyChange.java   | 2 +-
 .../cayenne/lifecycle/changemap/PropertyChangeVisitor.java   | 8 ++++----
 5 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/3a412a4a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableAttributeChange.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableAttributeChange.java
b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableAttributeChange.java
index 5dcb17a..6d6cdc0 100644
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableAttributeChange.java
+++ b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableAttributeChange.java
@@ -27,8 +27,8 @@ public class MutableAttributeChange implements AttributeChange {
 	private Object newValue;
 
 	@Override
-	public void accept(PropertyChangeVisitor visitor) {
-		visitor.visitAttribute(this);
+	public <T> T accept(PropertyChangeVisitor<T> visitor) {
+		return visitor.visitAttribute(this);
 	}
 
 	public void setOldValue(Object oldValue) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3a412a4a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableToManyRelationshipChange.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableToManyRelationshipChange.java
b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableToManyRelationshipChange.java
index 7b5a9cf..b49f618 100644
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableToManyRelationshipChange.java
+++ b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableToManyRelationshipChange.java
@@ -33,10 +33,10 @@ public class MutableToManyRelationshipChange implements ToManyRelationshipChange
 	private Collection<ObjectId> removed;
 
 	@Override
-	public void accept(PropertyChangeVisitor visitor) {
-		visitor.visitToManyRelationship(this);
+	public <T> T accept(PropertyChangeVisitor<T> visitor) {
+		return visitor.visitToManyRelationship(this);
 	}
-	
+
 	@Override
 	public Collection<ObjectId> getAdded() {
 		return added == null ? Collections.<ObjectId> emptyList() : added;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3a412a4a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableToOneRelationshipChange.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableToOneRelationshipChange.java
b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableToOneRelationshipChange.java
index 2501224..674938e 100644
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableToOneRelationshipChange.java
+++ b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/MutableToOneRelationshipChange.java
@@ -29,8 +29,8 @@ public class MutableToOneRelationshipChange implements ToOneRelationshipChange
{
 	private ObjectId newValue;
 
 	@Override
-	public void accept(PropertyChangeVisitor visitor) {
-		visitor.visitToOneRelationship(this);
+	public <T> T accept(PropertyChangeVisitor<T> visitor) {
+		return visitor.visitToOneRelationship(this);
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3a412a4a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/PropertyChange.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/PropertyChange.java
b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/PropertyChange.java
index 852642f..47e7323 100644
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/PropertyChange.java
+++ b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/PropertyChange.java
@@ -25,5 +25,5 @@ package org.apache.cayenne.lifecycle.changemap;
  */
 public interface PropertyChange {
 
-	void accept(PropertyChangeVisitor visitor);
+	<T> T accept(PropertyChangeVisitor<T> visitor);
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3a412a4a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/PropertyChangeVisitor.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/PropertyChangeVisitor.java
b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/PropertyChangeVisitor.java
index b49d4bc..134ba98 100644
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/PropertyChangeVisitor.java
+++ b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/changemap/PropertyChangeVisitor.java
@@ -21,11 +21,11 @@ package org.apache.cayenne.lifecycle.changemap;
 /**
  * @since 4.0
  */
-public interface PropertyChangeVisitor {
+public interface PropertyChangeVisitor<T> {
 
-	void visitAttribute(AttributeChange change);
+	T visitAttribute(AttributeChange change);
 
-	void visitToOneRelationship(ToOneRelationshipChange change);
+	T visitToOneRelationship(ToOneRelationshipChange change);
 
-	void visitToManyRelationship(ToManyRelationshipChange change);
+	T visitToManyRelationship(ToManyRelationshipChange change);
 }


Mime
View raw message