1 package org.onosproject.incubator.net.tunnel;
4 import org.onosproject.ui.table.CellFormatter;
5 import org.onosproject.ui.table.cell.AbstractCellFormatter;
8 * Formats a optical tunnel endpoint as "(type)/(element-id)/(port)".
9 * Formats a ip tunnel endpoint as "ip".
11 public final class TunnelEndPointFormatter extends AbstractCellFormatter {
13 private TunnelEndPointFormatter() {
17 protected String nonNullFormat(Object value) {
19 if (value instanceof DefaultOpticalTunnelEndPoint) {
20 DefaultOpticalTunnelEndPoint cp = (DefaultOpticalTunnelEndPoint) value;
21 return cp.type() + "/" + cp.elementId().get() + "/" + cp.portNumber().get();
22 } else if (value instanceof IpTunnelEndPoint) {
23 IpTunnelEndPoint cp = (IpTunnelEndPoint) value;
24 return cp.ip().toString();
30 * An instance of this class.
32 public static final CellFormatter INSTANCE = new TunnelEndPointFormatter();