Refactor JaxRsRestconfCallback
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / impl / RestconfInvokeOperationsServiceImpl.java
index 53d19a8911f00ca51521e2af429a67688471dc03..8589df772b7add9e5a629c18a8e626acf6007a81 100644 (file)
@@ -144,11 +144,16 @@ public final class RestconfInvokeOperationsServiceImpl {
                     ErrorTag.MALFORMED_MESSAGE, e);
         }
 
-        hackInvokeRpc(databind, reqPath, uriInfo, input).addCallback(new JaxRsRestconfCallback<>(ar,
-            result -> result
-                .filter(output -> !output.isEmpty())
-                .map(output -> Response.ok().entity(new NormalizedNodePayload(reqPath.inference(), output)).build())
-                .orElseGet(() -> Response.noContent().build())));
+        hackInvokeRpc(databind, reqPath, uriInfo, input).addCallback(new JaxRsRestconfCallback<>(ar) {
+            @Override
+            Response transform(final Optional<ContainerNode> result) {
+                return result
+                    .filter(output -> !output.isEmpty())
+                    .map(output -> Response.ok().entity(new NormalizedNodePayload(reqPath.inference(), output)).build())
+                    .orElseGet(() -> Response.noContent().build());
+            }
+        });
+
     }
 
     private RestconfFuture<Optional<ContainerNode>> hackInvokeRpc(final DatabindContext localDatabind,