Use instanceof pattern in netconf-impl
[netconf.git] / netconf / netconf-impl / src / main / java / org / opendaylight / netconf / impl / osgi / NetconfOperationRouterImpl.java
index 3aa1c7107243a89c3a1a92ff3e15131eb2ec3a09..b1ab4b26de966af71f94fdeb8019d8eed1ebf04e 100644 (file)
@@ -150,11 +150,11 @@ public class NetconfOperationRouterImpl implements NetconfOperationRouter {
 
         for (final NetconfOperation netconfOperation : allNetconfOperations) {
             final HandlingPriority handlingPriority = netconfOperation.canHandle(message);
-            if (netconfOperation instanceof DefaultNetconfOperation) {
-                ((DefaultNetconfOperation) netconfOperation).setNetconfSession(session);
+            if (netconfOperation instanceof DefaultNetconfOperation defaultOperation) {
+                defaultOperation.setNetconfSession(session);
             }
-            if (netconfOperation instanceof SessionAwareNetconfOperation) {
-                ((SessionAwareNetconfOperation) netconfOperation).setSession(session);
+            if (netconfOperation instanceof SessionAwareNetconfOperation sessionAwareOperation) {
+                sessionAwareOperation.setSession(session);
             }
             if (!handlingPriority.equals(HandlingPriority.CANNOT_HANDLE)) {