BUG-1089: use a string constant for "::::" 11/7711/4
authorRobert Varga <rovarga@cisco.com>
Wed, 4 Jun 2014 19:16:53 +0000 (21:16 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Fri, 6 Jun 2014 09:50:19 +0000 (09:50 +0000)
This just makes sure the class is always consistent in naming things.

Change-Id: I442eec4204e9a5a7073e023bad7e392c2c56c1be
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/compatibility/inventory-topology-compatibility/src/main/java/org/opendaylight/controller/md/compatibility/topology/TopologyMapping.java

index dbb6bdc..8e50bd8 100644 (file)
@@ -30,7 +30,8 @@ import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import com.google.common.base.Splitter;
 
 public class TopologyMapping {
 import com.google.common.base.Splitter;
 
 public class TopologyMapping {
-    private static final Splitter QUAD_COLON_SPLITTER = Splitter.on("::::");
+    private static final String HEAD_TAIL_STRING = "::::";
+    private static final Splitter HEAD_TAIL_SPLITTER = Splitter.on(HEAD_TAIL_STRING);
 
     public TopologyMapping(final TopologyKey path, final InstanceIdentifier<Topology> key) {
         // No-op for now. Multi-instance will require fixing InventoryMapping first.
 
     public TopologyMapping(final TopologyKey path, final InstanceIdentifier<Topology> key) {
         // No-op for now. Multi-instance will require fixing InventoryMapping first.
@@ -40,7 +41,7 @@ public class TopologyMapping {
         @SuppressWarnings("unchecked")
         final LinkKey linkKey = ((KeyedInstanceIdentifier<Link, LinkKey>)identifier).getKey();
 
         @SuppressWarnings("unchecked")
         final LinkKey linkKey = ((KeyedInstanceIdentifier<Link, LinkKey>)identifier).getKey();
 
-        final Iterator<String> it = QUAD_COLON_SPLITTER.split(linkKey.getLinkId().getValue()).iterator();
+        final Iterator<String> it = HEAD_TAIL_SPLITTER.split(linkKey.getLinkId().getValue()).iterator();
         final NodeConnector tail = InventoryMapping.nodeConnectorFromId(it.next());
         final NodeConnector head = InventoryMapping.nodeConnectorFromId(it.next());
         return new Edge(tail, head);
         final NodeConnector tail = InventoryMapping.nodeConnectorFromId(it.next());
         final NodeConnector head = InventoryMapping.nodeConnectorFromId(it.next());
         return new Edge(tail, head);
@@ -74,7 +75,7 @@ public class TopologyMapping {
 
         final StringBuilder sb = new StringBuilder();
         sb.append(sourceTp.getTpId().toString());
 
         final StringBuilder sb = new StringBuilder();
         sb.append(sourceTp.getTpId().toString());
-        sb.append("::::");
+        sb.append(HEAD_TAIL_STRING);
         sb.append(destTp.getTpId().toString());
         return new LinkKey(new LinkId(sb.toString()));
     }
         sb.append(destTp.getTpId().toString());
         return new LinkKey(new LinkId(sb.toString()));
     }