Class AugmentationGroupingResolver<G extends org.opendaylight.yangtools.yang.binding.DataObject,​T extends org.opendaylight.yangtools.yang.binding.Augmentable<T>>

  • Type Parameters:
    G - Grouping type
    T - Augmentable type
    All Implemented Interfaces:
    org.opendaylight.yangtools.concepts.Immutable, org.opendaylight.yangtools.concepts.MutationBehaviour<org.opendaylight.yangtools.concepts.Immutable>

    @Beta
    public final class AugmentationGroupingResolver<G extends org.opendaylight.yangtools.yang.binding.DataObject,​T extends org.opendaylight.yangtools.yang.binding.Augmentable<T>>
    extends Object
    implements org.opendaylight.yangtools.concepts.Immutable
    Resolver providing a bridge between a grouping and its various instantiations via augment. This is useful for extracting the grouping's content from a DataObject's augmentations without knowing from which instantiation it comes from.

    Typical use case is, given a base grouping module:

         module foo;
    
         grouping foo {
             container augmentable {
    
             }
         }
     
    and a module independent of it:
         module bar;
    
         container bar {
             uses foo:foo;
         }
     
    and
         module baz;
    
         container baz {
             uses foo:foo;
         }
     
    an external module can perform:
         module xyzzy;
    
         import bar { prefix bar; }
         import baz { prefix baz; }
    
         grouping something {
             // ...
         }
    
         augment /bar:bar/bar:augmentable {
             uses something;
         }
    
         augment /baz:baz/baz:augmentable {
             uses something;
         }
     
    The augmentations of bar and baz instantiations of grouping foo have an equivalent augmentation introduced by xyzzy. This equivalence is not expressed is generated code, in that it is not apparent given bar or baz there is an augmentation which provides something.

    This class provides the static knowledge to ask for the contents of something given an instance of augmentable, without knowing which augmentation introduces it.

    • Method Detail

      • findExtension

        public @NonNull Optional<G> findExtension​(T data)
      • builder

        public static <G extends org.opendaylight.yangtools.yang.binding.DataObject,​T extends org.opendaylight.yangtools.yang.binding.Augmentable<T>> @NonNull AugmentationGroupingResolver.Builder<G,​T> builder​(Class<G> groupingClass)
      • factory

        public static <T extends org.opendaylight.yangtools.yang.binding.Augmentable<T>> @NonNull AugmentationGroupingResolver.Factory<T> factory​(Class<T> augmentableClass,
                                                                                                                                                  Set<Class<? extends org.opendaylight.yangtools.yang.binding.Augmentation<T>>> augmentationClasses)