X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=binding%2Fmdsal-binding-runtime-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fbinding%2Fruntime%2Fapi%2FBindingRuntimeTypes.java;h=20a166688a7ae19022e00a44853ee26818cc30cc;hb=refs%2Fchanges%2F22%2F100122%2F11;hp=73235013f51ca3d187b1708bdf65ae66dc2cd944;hpb=2037a8c6e17b521c9ccf1ee3a1a965fa96cade3d;p=mdsal.git diff --git a/binding/mdsal-binding-runtime-api/src/main/java/org/opendaylight/mdsal/binding/runtime/api/BindingRuntimeTypes.java b/binding/mdsal-binding-runtime-api/src/main/java/org/opendaylight/mdsal/binding/runtime/api/BindingRuntimeTypes.java index 73235013f5..20a166688a 100644 --- a/binding/mdsal-binding-runtime-api/src/main/java/org/opendaylight/mdsal/binding/runtime/api/BindingRuntimeTypes.java +++ b/binding/mdsal-binding-runtime-api/src/main/java/org/opendaylight/mdsal/binding/runtime/api/BindingRuntimeTypes.java @@ -9,7 +9,10 @@ package org.opendaylight.mdsal.binding.runtime.api; import com.google.common.annotations.Beta; import java.util.Optional; +import java.util.Set; +import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.mdsal.binding.model.api.GeneratedType; import org.opendaylight.mdsal.binding.model.api.JavaTypeName; import org.opendaylight.yangtools.concepts.Immutable; import org.opendaylight.yangtools.yang.common.QName; @@ -38,4 +41,52 @@ public interface BindingRuntimeTypes extends EffectiveModelContextProvider, Runt } return tmp; } + + /** + * Lookup to all {@link CaseRuntimeType}s related to a {@link ChoiceRuntimeType}. This is important when dealing + * with sharing incurred by Binding Spec's reuse of constructs defined in a {@code grouping}. + * + *
+ * As an example, consider {@link ChoiceRuntimeType} and {@link CaseRuntimeType} relationship to + * {@link GeneratedType}s in the following model: + *
+ *
+ * grouping grp {
+ * container foo {
+ * choice bar;
+ * }
+ * }
+ *
+ * container foo {
+ * uses grp;
+ * }
+ *
+ * container bar {
+ * uses grp;
+ * }
+ *
+ * augment /foo/foo/bar {
+ * case baz
+ * }
+ *
+ * augment /bar/foo/bar {
+ * case xyzzy;
+ * }
+ *
+ *
+ * YANG view of what is valid in {@code /foo/foo/bar} differs from what is valid in {@code /bar/foo/bar}, but this
+ * difference is not reflected in generated Java constructs. More notably, the two augments being in different
+ * modules. Since {@code choice bar}'s is part of a reusable construct, {@code grouping one}, DataObjects' copy
+ * builders can propagate them without translating them to the appropriate manifestation -- and they can do nothing
+ * about that as they lack the complete view of the effective model.
+ *
+ *
+ * This method provides a bridge between a particular instantiation of a {@code choice} to {@link CaseRuntimeType}s
+ * valid in all instantiations.
+ *
+ * @param choiceType A ChoiceRuntimeType
+ * @return The set of {@link CaseRuntimeType}s known to this instance
+ * @throws NullPointerException if {@code ChoiceRuntimeType} is null
+ */
+ @NonNull Set