Do not use KeyAware in BindingMap 42/112442/3
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 4 Jul 2024 14:59:52 +0000 (16:59 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 4 Jul 2024 16:29:06 +0000 (18:29 +0200)
We are using EntryObjects, use key() method from there rather than from
KeyAware.

JIRA: YANGTOOLS-1577
Change-Id: Ib9cf83dfdbd3743f92bbfb38581eacae1ee58607
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/binding-spec/src/main/java/org/opendaylight/yangtools/binding/util/BindingMap.java

index e720cf1c5bf6c569f7d19ea9f3cd951ebc11880c..3d6e09a5f543e03a83aaec4bd6752c7ca65808c3 100644 (file)
@@ -20,7 +20,6 @@ import java.util.stream.Collectors;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.binding.EntryObject;
 import org.opendaylight.yangtools.binding.Key;
-import org.opendaylight.yangtools.binding.KeyAware;
 
 /**
  * Utility class for instantiating Maps containing {@link EntryObject} values. Unlike normal Map instantiation
@@ -308,8 +307,8 @@ public final class BindingMap {
     }
 
     /**
-     * Returns a collector which collects binding {@link KeyAware} objects into an unmodifiable map. The resulting
-     * map is <b>NOT</b> guaranteed to retain iteration order of the stream it collects.
+     * Returns a collector which collects binding {@link EntryObject}s into an unmodifiable map. The resulting map is
+     * <b>NOT</b> guaranteed to retain iteration order of the stream it collects.
      *
      * @param <K> the {@code Map}'s key type
      * @param <V> the {@code Map}'s value type
@@ -317,7 +316,7 @@ public final class BindingMap {
      */
     public static <K extends Key<V>, V extends EntryObject<V, K>>
             @NonNull Collector<V, ?, ? extends Map<K, V>> toMap() {
-        return Collectors.toUnmodifiableMap(KeyAware::key, v -> v);
+        return Collectors.toUnmodifiableMap(EntryObject::key, v -> v);
     }
 
     /**
@@ -458,7 +457,7 @@ public final class BindingMap {
      */
     public static <K extends Key<V>, V extends EntryObject<V, K>>
             @NonNull Collector<V, ?, ? extends Map<K, V>> toOrderedMap() {
-        return ImmutableMap.<V, K, V>toImmutableMap(KeyAware::key, v -> v);
+        return ImmutableMap.<V, K, V>toImmutableMap(EntryObject::key, v -> v);
     }
 
     /**