ss: Avoid concatenating nonliterals in TmfStateInterval#toString()
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Fri, 27 Nov 2015 22:36:24 +0000 (17:36 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 3 Dec 2015 23:27:55 +0000 (18:27 -0500)
Change-Id: Ia5a18114a73418ad677b7d8b3a606c2f67af36b2
Signed-off-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/60557
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
statesystem/org.eclipse.tracecompass.statesystem.core/META-INF/MANIFEST.MF
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/statesystem/core/interval/TmfStateInterval.java

index e5e675127d83fd2eacffbe01a7e7ba77b0388f29..e7b64818264e83a9b9a76e4fa0bd0ae23d430949 100644 (file)
@@ -19,4 +19,5 @@ Export-Package: org.eclipse.tracecompass.internal.statesystem.core;x-friends:="o
  org.eclipse.tracecompass.statesystem.core.exceptions,
  org.eclipse.tracecompass.statesystem.core.interval,
  org.eclipse.tracecompass.statesystem.core.statevalue
-Import-Package: com.google.common.collect;version="12.0.0"
+Import-Package: com.google.common.base,
+ com.google.common.collect;version="12.0.0"
index be4e50e878bcb52dc0e444e6c6f31fc3961b0985..d2bd91c4f33af72096141e713c44cef8a1032a87 100644 (file)
@@ -14,6 +14,8 @@ package org.eclipse.tracecompass.statesystem.core.interval;
 
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
 
+import com.google.common.base.Objects;
+
 /**
  * The StateInterval represents the "state" a particular attribute was in, at a
  * given time. It is the main object being returned from queries to the state
@@ -81,11 +83,12 @@ public final class TmfStateInterval implements ITmfStateInterval {
     @Override
     public String toString() {
         /* Only used for debugging */
-        StringBuffer buf = new StringBuffer(start + " to "); //$NON-NLS-1$
-        buf.append(end + ", "); //$NON-NLS-1$
-        buf.append(String.format("key = %4d, ", attribute)); //$NON-NLS-1$
-        buf.append("value = " + sv.toString()); //$NON-NLS-1$
-        return buf.toString();
+        return Objects.toStringHelper(this)
+            .add("start", start) //$NON-NLS-1$
+            .add("end", end) //$NON-NLS-1$
+            .add("key", attribute) //$NON-NLS-1$
+            .add("value", sv.toString()) //$NON-NLS-1$
+            .toString();
     }
 
 }
This page took 0.026127 seconds and 5 git commands to generate.