brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [2/4] brooklyn-server git commit: Adding more information to toString methods
Date Mon, 13 Jun 2016 08:29:51 GMT
Adding more information to toString methods


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

Branch: refs/heads/master
Commit: 3a2c41cf0f651c8e386faaadb96339f8c7b8fdf3
Parents: 5e1517b
Author: Kiuby88 <kiuby88.programming@gmail.com>
Authored: Tue May 31 10:21:53 2016 +0200
Committer: Kiuby88 <kiuby88.programming@gmail.com>
Committed: Tue May 31 10:21:53 2016 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/brooklyn/api/entity/EntitySpec.java  | 5 -----
 .../brooklyn/api/internal/AbstractBrooklynObjectSpec.java     | 5 ++++-
 .../group/zoneaware/ProportionalZoneFailureDetector.java      | 7 ++++++-
 3 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3a2c41cf/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java b/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java
index d4162f3..30df4ed 100644
--- a/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java
+++ b/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java
@@ -433,9 +433,4 @@ public class EntitySpec<T extends Entity> extends AbstractBrooklynObjectSpec<T,E
         if (immutable) throw new IllegalStateException("Cannot modify immutable entity spec
"+this);
     }
 
-    @Override
-    public String toString(){
-        return getClass().getName();
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3a2c41cf/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
b/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
index ef99a27..32d5d5d 100644
--- a/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
+++ b/api/src/main/java/org/apache/brooklyn/api/internal/AbstractBrooklynObjectSpec.java
@@ -83,7 +83,10 @@ public abstract class AbstractBrooklynObjectSpec<T,SpecT extends AbstractBrookly
 
     @Override
     public String toString() {
-        return Objects.toStringHelper(this).add("type", getType()).toString()+"@"+Integer.toHexString(System.identityHashCode(this));
+        return Objects.toStringHelper(this).omitNullValues()
+                .add("type", type)
+                .add("displayName", displayName)
+                .toString();
     }
 
     protected abstract void checkValidType(Class<? extends T> type);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3a2c41cf/core/src/main/java/org/apache/brooklyn/entity/group/zoneaware/ProportionalZoneFailureDetector.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/entity/group/zoneaware/ProportionalZoneFailureDetector.java
b/core/src/main/java/org/apache/brooklyn/entity/group/zoneaware/ProportionalZoneFailureDetector.java
index 73a4c43..990ea71 100644
--- a/core/src/main/java/org/apache/brooklyn/entity/group/zoneaware/ProportionalZoneFailureDetector.java
+++ b/core/src/main/java/org/apache/brooklyn/entity/group/zoneaware/ProportionalZoneFailureDetector.java
@@ -21,6 +21,7 @@ package org.apache.brooklyn.entity.group.zoneaware;
 import org.apache.brooklyn.api.location.Location;
 import org.apache.brooklyn.util.time.Duration;
 
+import com.google.common.base.Objects;
 import com.google.common.base.Ticker;
 
 public class ProportionalZoneFailureDetector extends AbstractZoneFailureDetector {
@@ -59,7 +60,11 @@ public class ProportionalZoneFailureDetector extends AbstractZoneFailureDetector
 
     @Override
     public String toString(){
-        return getClass().getName();
+        return Objects.toStringHelper(this)
+                .add("minDatapoints", minDatapoints)
+                .add("timeToConsider",  timeToConsider)
+                .add("maxProportionFailures", maxProportionFailures)
+                .toString();
     }
 
 }


Mime
View raw message