Cleaning up Javadocs in core-ui classes.
Added common constants to AbstractCellFormatter.
Change-Id: Ie20ea62f059646e7d6c7f3660dd60a60c40532fe
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellComparator.java b/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellComparator.java
index b042c85..31f42ea 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellComparator.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellComparator.java
@@ -42,19 +42,17 @@
/**
* Compares its two arguments for order. Returns a negative integer,
* zero, or a positive integer as the first argument is less than, equal
- * to, or greater than the second.<p>
- *
+ * to, or greater than the second.
+ * <p>
* Note that both objects are guaranteed to be non-null.
*
* @see java.util.Comparator#compare(Object, Object)
*
- * @param o1 the first object to be compared.
- * @param o2 the second object to be compared.
- * @return a negative integer, zero, or a positive integer as the
- * first argument is less than, equal to, or greater than the
- * second.
+ * @param o1 the first object to be compared
+ * @param o2 the second object to be compared
+ * @return an integer representing relative ordering
* @throws ClassCastException if the arguments' types prevent them from
- * being compared by this comparator.
+ * being compared by this comparator
*/
protected abstract int nonNullCompare(Object o1, Object o2);
}
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellFormatter.java b/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellFormatter.java
index 4329f14..3f3afc4 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellFormatter.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/AbstractCellFormatter.java
@@ -25,9 +25,17 @@
*/
public abstract class AbstractCellFormatter implements CellFormatter {
+ protected static final String EMPTY = "";
+ protected static final String SLASH = "/";
+ protected static final String QUERY = "?";
+ protected static final String UNDERSCORE = "_";
+ protected static final String SPACE = " ";
+ protected static final String OX = "0x";
+
+
@Override
public String format(Object value) {
- return value == null ? "" : nonNullFormat(value);
+ return value == null ? EMPTY : nonNullFormat(value);
}
/**
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/AppIdFormatter.java b/core/api/src/main/java/org/onosproject/ui/table/cell/AppIdFormatter.java
index d44836f..9966a88 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/AppIdFormatter.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/AppIdFormatter.java
@@ -24,6 +24,8 @@
*/
public final class AppIdFormatter extends AbstractCellFormatter {
+ private static final String COLON = " : ";
+
// non-instantiable
private AppIdFormatter() { }
@@ -31,7 +33,7 @@
@Override
protected String nonNullFormat(Object value) {
ApplicationId appId = (ApplicationId) value;
- return appId.id() + " : " + appId.name();
+ return appId.id() + COLON + appId.name();
}
/**
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/ConnectPointFormatter.java b/core/api/src/main/java/org/onosproject/ui/table/cell/ConnectPointFormatter.java
index f64c296..7d9964f 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/ConnectPointFormatter.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/ConnectPointFormatter.java
@@ -30,7 +30,7 @@
@Override
protected String nonNullFormat(Object value) {
ConnectPoint cp = (ConnectPoint) value;
- return cp.elementId() + "/" + cp.port();
+ return cp.elementId() + SLASH + cp.port();
}
/**
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/EnumFormatter.java b/core/api/src/main/java/org/onosproject/ui/table/cell/EnumFormatter.java
index e8e41e8..7a8d9aa 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/EnumFormatter.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/EnumFormatter.java
@@ -30,7 +30,7 @@
@Override
protected String nonNullFormat(Object value) {
- return capitalizeFully(value.toString().replace("_", " "));
+ return capitalizeFully(value.toString().replace(UNDERSCORE, SPACE));
}
/**
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/HexFormatter.java b/core/api/src/main/java/org/onosproject/ui/table/cell/HexFormatter.java
index e96a8be..4e3194b 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/HexFormatter.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/HexFormatter.java
@@ -28,7 +28,7 @@
@Override
protected String nonNullFormat(Object value) {
- return "0x" + Integer.toHexString((Integer) value);
+ return OX + Integer.toHexString((Integer) value);
}
/**
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/HexLongFormatter.java b/core/api/src/main/java/org/onosproject/ui/table/cell/HexLongFormatter.java
index c5bb69d..67d0fa3 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/HexLongFormatter.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/HexLongFormatter.java
@@ -28,7 +28,7 @@
@Override
protected String nonNullFormat(Object value) {
- return "0x" + Long.toHexString((Long) value);
+ return OX + Long.toHexString((Long) value);
}
/**
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/HostLocationFormatter.java b/core/api/src/main/java/org/onosproject/ui/table/cell/HostLocationFormatter.java
index 306cea1..be652ca 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/HostLocationFormatter.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/HostLocationFormatter.java
@@ -30,7 +30,7 @@
@Override
protected String nonNullFormat(Object value) {
HostLocation loc = (HostLocation) value;
- return loc.deviceId() + "/" + loc.port();
+ return loc.deviceId() + SLASH + loc.port();
}
/**
diff --git a/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java b/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java
index 597a8a4..93c0754 100644
--- a/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java
+++ b/core/api/src/main/java/org/onosproject/ui/table/cell/NumberFormatter.java
@@ -22,7 +22,7 @@
import java.text.NumberFormat;
/**
- * Formats number using the specified format string".
+ * Formats number using the specified format string.
*/
public final class NumberFormatter extends AbstractCellFormatter {