Small refactor of NetconfRestconfStrategy class 34/110734/1
authorIvan Hrasko <ivan.hrasko@pantheon.tech>
Thu, 14 Mar 2024 13:28:56 +0000 (14:28 +0100)
committerIvan Hrasko <ivan.hrasko@pantheon.tech>
Thu, 14 Mar 2024 13:33:34 +0000 (14:33 +0100)
Make small refactoring changes in NetconfRestconfStrategy class:
- NetconfFieldsTranslator.translate return type is NonNull thus 'tmp'
cannot be null, remove null check
- fix javadoc parameters and typos
- use diamond operator where possible

Change-Id: I6efc489d8e5a8352d0c2867ea4937d1df7829876
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/transactions/NetconfRestconfStrategy.java

index cd7186d231c61ffbe77048f0bb7627d06f732e79..82a06c368d22791d05f624c3564458d814a73511 100644 (file)
@@ -93,7 +93,7 @@ public final class NetconfRestconfStrategy extends RestconfStrategy {
             } catch (RestconfDocumentedException e) {
                 return RestconfFuture.failed(e);
             }
-            fieldPaths = tmp == null || tmp.isEmpty() ? null : tmp;
+            fieldPaths = tmp.isEmpty() ? null : tmp;
         } else {
             fieldPaths = null;
         }
@@ -131,7 +131,7 @@ public final class NetconfRestconfStrategy extends RestconfStrategy {
      * @param content  type of data to read (config, state, all)
      * @param path     the parent path to read
      * @param withDefa value of with-defaults parameter
-     * @param fields   paths to selected subtrees which should be read, relative to to the parent path
+     * @param fields   paths to selected subtrees which should be read, relative to the parent path
      * @return {@link NormalizedNode}
      */
     // FIXME: NETCONF-1155: this method should asynchronous
@@ -162,9 +162,7 @@ public final class NetconfRestconfStrategy extends RestconfStrategy {
      *
      * @param store                 datastore type
      * @param path                  parent path to selected fields
-     * @param closeTransactionChain if it is set to {@code true}, after transaction it will close transactionChain
-     *                              in {@link RestconfStrategy} if any
-     * @param fields                paths to selected subtrees which should be read, relative to to the parent path
+     * @param fields                paths to selected subtrees which should be read, relative to the parent path
      * @return {@link NormalizedNode}
      */
     private @Nullable NormalizedNode readDataViaTransaction(final @NonNull LogicalDatastoreType store,
@@ -181,7 +179,7 @@ public final class NetconfRestconfStrategy extends RestconfStrategy {
 
     private static <T> ListenableFuture<T> remapException(final ListenableFuture<T> input) {
         final var ret = SettableFuture.<T>create();
-        Futures.addCallback(input, new FutureCallback<T>() {
+        Futures.addCallback(input, new FutureCallback<>() {
             @Override
             public void onSuccess(final T result) {
                 ret.set(result);