Committed by
Gerrit Code Review
GUI -- Made OOTB formatters and comparators final classes.
Change-Id: I0ea59bf92d97b6d104b7d3770fb5f2e93308bbdc
Showing
10 changed files
with
40 additions
and
10 deletions
... | @@ -23,7 +23,10 @@ import org.onosproject.ui.table.CellFormatter; | ... | @@ -23,7 +23,10 @@ import org.onosproject.ui.table.CellFormatter; |
23 | /** | 23 | /** |
24 | * Formats an application identifier as "(app-id) : (app-name)". | 24 | * Formats an application identifier as "(app-id) : (app-name)". |
25 | */ | 25 | */ |
26 | -public class AppIdFormatter extends AbstractCellFormatter { | 26 | +public final class AppIdFormatter extends AbstractCellFormatter { |
27 | + | ||
28 | + // non-instantiable | ||
29 | + private AppIdFormatter() { } | ||
27 | 30 | ||
28 | @Override | 31 | @Override |
29 | protected String nonNullFormat(Object value) { | 32 | protected String nonNullFormat(Object value) { | ... | ... |
... | @@ -23,7 +23,10 @@ import org.onosproject.ui.table.CellFormatter; | ... | @@ -23,7 +23,10 @@ import org.onosproject.ui.table.CellFormatter; |
23 | /** | 23 | /** |
24 | * Formats a connect point as "(element-id)/(port)". | 24 | * Formats a connect point as "(element-id)/(port)". |
25 | */ | 25 | */ |
26 | -public class ConnectPointFormatter extends AbstractCellFormatter { | 26 | +public final class ConnectPointFormatter extends AbstractCellFormatter { |
27 | + | ||
28 | + // non-instantiable | ||
29 | + private ConnectPointFormatter() { } | ||
27 | 30 | ||
28 | @Override | 31 | @Override |
29 | protected String nonNullFormat(Object value) { | 32 | protected String nonNullFormat(Object value) { | ... | ... |
... | @@ -25,7 +25,10 @@ import org.onosproject.ui.table.CellComparator; | ... | @@ -25,7 +25,10 @@ import org.onosproject.ui.table.CellComparator; |
25 | * compares the resulting strings. Note that null values are acceptable and | 25 | * compares the resulting strings. Note that null values are acceptable and |
26 | * are considered "smaller" than any non-null value. | 26 | * are considered "smaller" than any non-null value. |
27 | */ | 27 | */ |
28 | -public class DefaultCellComparator extends AbstractCellComparator { | 28 | +public final class DefaultCellComparator extends AbstractCellComparator { |
29 | + | ||
30 | + // non-instantiable | ||
31 | + private DefaultCellComparator() { } | ||
29 | 32 | ||
30 | @Override | 33 | @Override |
31 | protected int nonNullCompare(Object o1, Object o2) { | 34 | protected int nonNullCompare(Object o1, Object o2) { | ... | ... |
... | @@ -22,7 +22,10 @@ import org.onosproject.ui.table.CellFormatter; | ... | @@ -22,7 +22,10 @@ import org.onosproject.ui.table.CellFormatter; |
22 | /** | 22 | /** |
23 | * A default cell formatter. Uses the object's toString() method. | 23 | * A default cell formatter. Uses the object's toString() method. |
24 | */ | 24 | */ |
25 | -public class DefaultCellFormatter extends AbstractCellFormatter { | 25 | +public final class DefaultCellFormatter extends AbstractCellFormatter { |
26 | + | ||
27 | + // non-instantiable | ||
28 | + private DefaultCellFormatter() { } | ||
26 | 29 | ||
27 | @Override | 30 | @Override |
28 | public String nonNullFormat(Object value) { | 31 | public String nonNullFormat(Object value) { | ... | ... |
... | @@ -23,7 +23,10 @@ import static org.apache.commons.lang.WordUtils.capitalizeFully; | ... | @@ -23,7 +23,10 @@ import static org.apache.commons.lang.WordUtils.capitalizeFully; |
23 | /** | 23 | /** |
24 | * Formats enum types to be readable strings. | 24 | * Formats enum types to be readable strings. |
25 | */ | 25 | */ |
26 | -public class EnumFormatter extends AbstractCellFormatter { | 26 | +public final class EnumFormatter extends AbstractCellFormatter { |
27 | + | ||
28 | + // non-instantiable | ||
29 | + private EnumFormatter() { } | ||
27 | 30 | ||
28 | @Override | 31 | @Override |
29 | protected String nonNullFormat(Object value) { | 32 | protected String nonNullFormat(Object value) { | ... | ... |
... | @@ -22,7 +22,10 @@ import org.onosproject.ui.table.CellFormatter; | ... | @@ -22,7 +22,10 @@ import org.onosproject.ui.table.CellFormatter; |
22 | /** | 22 | /** |
23 | * Formats integer values as hex strings with a "0x" prefix. | 23 | * Formats integer values as hex strings with a "0x" prefix. |
24 | */ | 24 | */ |
25 | -public class HexFormatter extends AbstractCellFormatter { | 25 | +public final class HexFormatter extends AbstractCellFormatter { |
26 | + | ||
27 | + // non-instantiable | ||
28 | + private HexFormatter() { } | ||
26 | 29 | ||
27 | @Override | 30 | @Override |
28 | protected String nonNullFormat(Object value) { | 31 | protected String nonNullFormat(Object value) { | ... | ... |
... | @@ -23,7 +23,10 @@ import org.onosproject.ui.table.CellFormatter; | ... | @@ -23,7 +23,10 @@ import org.onosproject.ui.table.CellFormatter; |
23 | /** | 23 | /** |
24 | * Formats a host location as "(device-id)/(port)". | 24 | * Formats a host location as "(device-id)/(port)". |
25 | */ | 25 | */ |
26 | -public class HostLocationFormatter extends AbstractCellFormatter { | 26 | +public final class HostLocationFormatter extends AbstractCellFormatter { |
27 | + | ||
28 | + // non-instantiable | ||
29 | + private HostLocationFormatter() { } | ||
27 | 30 | ||
28 | @Override | 31 | @Override |
29 | protected String nonNullFormat(Object value) { | 32 | protected String nonNullFormat(Object value) { | ... | ... |
... | @@ -24,7 +24,10 @@ import org.onosproject.ui.table.CellComparator; | ... | @@ -24,7 +24,10 @@ import org.onosproject.ui.table.CellComparator; |
24 | * Note that null values are acceptable and are considered "smaller" than | 24 | * Note that null values are acceptable and are considered "smaller" than |
25 | * any non-null value. | 25 | * any non-null value. |
26 | */ | 26 | */ |
27 | -public class IntComparator extends AbstractCellComparator { | 27 | +public final class IntComparator extends AbstractCellComparator { |
28 | + | ||
29 | + // non-instantiable | ||
30 | + private IntComparator() { } | ||
28 | 31 | ||
29 | @Override | 32 | @Override |
30 | protected int nonNullCompare(Object o1, Object o2) { | 33 | protected int nonNullCompare(Object o1, Object o2) { | ... | ... |
... | @@ -24,7 +24,10 @@ import org.onosproject.ui.table.CellComparator; | ... | @@ -24,7 +24,10 @@ import org.onosproject.ui.table.CellComparator; |
24 | * Note that null values are acceptable and are considered "smaller" than | 24 | * Note that null values are acceptable and are considered "smaller" than |
25 | * any non-null value. | 25 | * any non-null value. |
26 | */ | 26 | */ |
27 | -public class LongComparator extends AbstractCellComparator { | 27 | +public final class LongComparator extends AbstractCellComparator { |
28 | + | ||
29 | + // non-instantiable | ||
30 | + private LongComparator() { } | ||
28 | 31 | ||
29 | @Override | 32 | @Override |
30 | protected int nonNullCompare(Object o1, Object o2) { | 33 | protected int nonNullCompare(Object o1, Object o2) { | ... | ... |
... | @@ -25,10 +25,13 @@ import org.onosproject.ui.table.CellFormatter; | ... | @@ -25,10 +25,13 @@ import org.onosproject.ui.table.CellFormatter; |
25 | /** | 25 | /** |
26 | * Formats time values using {@link DateTimeFormatter}. | 26 | * Formats time values using {@link DateTimeFormatter}. |
27 | */ | 27 | */ |
28 | -public class TimeFormatter extends AbstractCellFormatter { | 28 | +public final class TimeFormatter extends AbstractCellFormatter { |
29 | 29 | ||
30 | private static final DateTimeFormatter DTF = DateTimeFormat.longTime(); | 30 | private static final DateTimeFormatter DTF = DateTimeFormat.longTime(); |
31 | 31 | ||
32 | + // non-instantiable | ||
33 | + private TimeFormatter() { } | ||
34 | + | ||
32 | @Override | 35 | @Override |
33 | protected String nonNullFormat(Object value) { | 36 | protected String nonNullFormat(Object value) { |
34 | return DTF.print((DateTime) value); | 37 | return DTF.print((DateTime) value); | ... | ... |
-
Please register or login to post a comment