Class YangUtils


  • public final class YangUtils
    extends Object
    YANG utility functions.
    • Method Detail

      • copyYangKeyValueListToMap

        public static <T,​K,​V> @NonNull Map<K,​V> copyYangKeyValueListToMap​(@NonNull Map<K,​V> map,
                                                                                            @Nullable Iterable<T> yangList,
                                                                                            @NonNull Function<T,​K> keyExtractor,
                                                                                            @NonNull Function<T,​V> valueExtractor)
        Copies a list of YANG key-value items to the given map. Any null key or value will cause an error.
        Type Parameters:
        T - The YANG item type.
        K - The key type.
        V - The value type.
        Parameters:
        map - The map to fill.
        yangList - The list of YANG key-value items.
        keyExtractor - The key extractor function to use.
        valueExtractor - The value extractor function to use.
        Returns:
        The map.
      • copyYangKeyValueListToMap

        public static <I extends org.opendaylight.yangtools.yang.binding.Identifier<T>,​T extends org.opendaylight.yangtools.yang.binding.Identifiable<I>,​K,​V> @NonNull Map<K,​V> copyYangKeyValueListToMap​(@NonNull Map<K,​V> map,
                                                                                                                                                                                                                                  @Nullable Map<I,​T> yangList,
                                                                                                                                                                                                                                  @NonNull Function<T,​K> keyExtractor,
                                                                                                                                                                                                                                  @NonNull Function<T,​V> valueExtractor)
        Copies a list of YANG key-value items to the given map. Any null key or value will cause an error.
        Type Parameters:
        T - The YANG item type.
        K - The key type.
        V - The value type.
        Parameters:
        map - The map to fill.
        yangList - The map of YANG key-value items.
        keyExtractor - The key extractor function to use.
        valueExtractor - The value extractor function to use.
        Returns:
        The map.
      • convertYangKeyValueListToMap

        public static <T,​K,​V> @NonNull Map<K,​V> convertYangKeyValueListToMap​(@Nullable Iterable<T> yangList,
                                                                                               @NonNull Function<T,​K> keyExtractor,
                                                                                               @NonNull Function<T,​V> valueExtractor)
        Converts a list of YANG key-value items to a map.
        Type Parameters:
        T - The YANG item type.
        K - The key type.
        V - The value type.
        Parameters:
        yangList - The list of YANG key-value items.
        keyExtractor - The key extractor function to use.
        valueExtractor - The value extractor function to use.
        Returns:
        The map.
      • convertYangKeyValueListToMap

        public static <I extends org.opendaylight.yangtools.yang.binding.Identifier<T>,​T extends org.opendaylight.yangtools.yang.binding.Identifiable<I>,​K,​V> @NonNull Map<K,​V> convertYangKeyValueListToMap​(@Nullable Map<I,​T> yangList,
                                                                                                                                                                                                                                     @NonNull Function<T,​K> keyExtractor,
                                                                                                                                                                                                                                     @NonNull Function<T,​V> valueExtractor)
        Converts a list of YANG key-value items to a map.
        Type Parameters:
        T - The YANG item type.
        K - The key type.
        V - The value type.
        Parameters:
        yangList - The map of YANG key-value items.
        keyExtractor - The key extractor function to use.
        valueExtractor - The value extractor function to use.
        Returns:
        The map.