Move createProxy() 34/83834/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Aug 2019 20:56:26 +0000 (22:56 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 20 Aug 2019 22:59:18 +0000 (00:59 +0200)
This is a simple internal method, inline it.

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

index 5d0039c..1981bd6 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
@@ -32,7 +33,9 @@ public class BindingDOMRpcServiceAdapter implements RpcConsumerRegistry {
 
                 @Override
                 public RpcServiceAdapter load(final Class<? extends RpcService> key) {
-                    return createProxy(key);
+                    checkArgument(BindingReflections.isBindingClass(key));
+                    checkArgument(key.isInterface(), "Supplied RPC service type must be interface.");
+                    return new RpcServiceAdapter(key, codec, domService);
                 }
 
             });
@@ -48,16 +51,10 @@ public class BindingDOMRpcServiceAdapter implements RpcConsumerRegistry {
     @SuppressWarnings("unchecked")
     @Override
     public <T extends RpcService> T getRpcService(final Class<T> rpcService) {
-        Preconditions.checkArgument(rpcService != null, "Rpc Service needs to be specied.");
+        checkArgument(rpcService != null, "Rpc Service needs to be specied.");
         return (T) proxies.getUnchecked(rpcService).getProxy();
     }
 
-    private RpcServiceAdapter createProxy(final Class<? extends RpcService> key) {
-        Preconditions.checkArgument(BindingReflections.isBindingClass(key));
-        Preconditions.checkArgument(key.isInterface(), "Supplied RPC service type must be interface.");
-        return new RpcServiceAdapter(key, codec, domService);
-    }
-
     private static final class Builder extends BindingDOMAdapterBuilder<RpcConsumerRegistry> {
 
         @Override
@@ -71,7 +68,5 @@ public class BindingDOMRpcServiceAdapter implements RpcConsumerRegistry {
         public Set<? extends Class<? extends DOMService>> getRequiredDelegates() {
             return ImmutableSet.of(DOMRpcService.class);
         }
-
     }
-
 }

©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.