Hide DOMMountPointServiceImpl.registerMountPoint implementation 77/77577/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 7 Nov 2018 11:39:29 +0000 (12:39 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 7 Nov 2018 12:19:50 +0000 (13:19 +0100)
This adds a trivial package-protected method which holds the
implementation, allowing us to short-circuit some casts.

Change-Id: I41d792c50d87638fc6ba51433cd26bf68980fca2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/mount/DOMMountPointServiceImpl.java

index f973c43..b73f177 100644 (file)
@@ -96,19 +96,22 @@ public class DOMMountPointServiceImpl implements DOMMountPointService {
      *         public {@link #createMountPoint} interface. As such, this method expects the {@code mountPoint} param
      *         to be of type {@link SimpleDOMMountPoint}.
      */
-    @SuppressWarnings("unchecked")
     @Deprecated
     public ObjectRegistration<DOMMountPoint> registerMountPoint(final DOMMountPoint mountPoint) {
         Preconditions.checkArgument(mountPoint instanceof SimpleDOMMountPoint, "Expected SimpleDOMMountPoint");
+        return doRegisterMountPoint((SimpleDOMMountPoint) mountPoint);
+    }
 
+    @SuppressWarnings("unchecked")
+    ObjectRegistration<DOMMountPoint> doRegisterMountPoint(final SimpleDOMMountPoint mountPoint) {
         final org.opendaylight.mdsal.dom.api.DOMMountPointService.DOMMountPointBuilder delegateBuilder =
-            delegate.createMountPoint(mountPoint.getIdentifier());
+                delegate.createMountPoint(mountPoint.getIdentifier());
 
         if (mountPoint.getSchemaContext() != null) {
             delegateBuilder.addInitialSchemaContext(mountPoint.getSchemaContext());
         }
 
-        ((SimpleDOMMountPoint)mountPoint).getAllServices().forEach(
+        mountPoint.getAllServices().forEach(
             entry -> delegateBuilder.addService((Class<DOMService>)entry.getKey(), entry.getValue()));
 
         final ObjectRegistration<org.opendaylight.mdsal.dom.api.DOMMountPoint> delegateReg = delegateBuilder.register();
@@ -152,7 +155,7 @@ public class DOMMountPointServiceImpl implements DOMMountPointService {
         public ObjectRegistration<DOMMountPoint> register() {
             Preconditions.checkState(mountPoint == null, "Mount point is already built.");
             mountPoint = SimpleDOMMountPoint.create(path, services, schemaContext);
-            return registerMountPoint(mountPoint);
+            return doRegisterMountPoint(mountPoint);
         }
     }
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.