X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=binding%2Fmdsal-binding-generator%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fbinding%2Fgenerator%2Fimpl%2Freactor%2FOriginalLink.java;h=3d9009a42b4c6dfc068e38f2f7bb22799df5178b;hb=refs%2Fchanges%2F46%2F99846%2F3;hp=9794da4cf8e8d839f5c1f40bc8a934922a3aefd5;hpb=99ad8cf4b208bb56db5a38bf7a3a5a6a7dcbb350;p=mdsal.git diff --git a/binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/OriginalLink.java b/binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/OriginalLink.java index 9794da4cf8..3d9009a42b 100644 --- a/binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/OriginalLink.java +++ b/binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/OriginalLink.java @@ -13,26 +13,27 @@ import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects.ToStringHelper; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement; /** * Link to the original definition of an {@link AbstractExplicitGenerator}. */ // FIXME: sealed when we have JDK17+ -abstract class OriginalLink { - private static final class Complete extends OriginalLink { - private final @NonNull AbstractExplicitGenerator original; +abstract class OriginalLink> { + private static final class Complete> extends OriginalLink { + private final @NonNull AbstractExplicitGenerator original; - Complete(final AbstractExplicitGenerator original) { + Complete(final AbstractExplicitGenerator original) { this.original = requireNonNull(original); } @Override - AbstractExplicitGenerator previous() { + AbstractExplicitGenerator previous() { return original; } @Override - @NonNull AbstractExplicitGenerator original() { + @NonNull AbstractExplicitGenerator original() { return original; } @@ -42,21 +43,21 @@ abstract class OriginalLink { } } - private static final class Partial extends OriginalLink { - private final @NonNull AbstractExplicitGenerator previous; - private AbstractExplicitGenerator original; + private static final class Partial> extends OriginalLink { + private final @NonNull AbstractExplicitGenerator previous; + private AbstractExplicitGenerator original; - Partial(final AbstractExplicitGenerator previous) { + Partial(final AbstractExplicitGenerator previous) { this.previous = requireNonNull(previous); } @Override - AbstractExplicitGenerator previous() { + AbstractExplicitGenerator previous() { return previous; } @Override - AbstractExplicitGenerator original() { + AbstractExplicitGenerator original() { if (original == null) { final var link = previous.originalLink(); if (link instanceof Complete || link.previous() != previous) { @@ -76,17 +77,19 @@ abstract class OriginalLink { // Hidden on purpose } - static @NonNull OriginalLink complete(final AbstractExplicitGenerator original) { - return new Complete(original); + static > @NonNull OriginalLink complete( + final AbstractExplicitGenerator original) { + return new Complete<>(original); } - static @NonNull OriginalLink partial(final AbstractExplicitGenerator previous) { - return new Partial(previous); + static > @NonNull OriginalLink partial( + final AbstractExplicitGenerator previous) { + return new Partial<>(previous); } - abstract @NonNull AbstractExplicitGenerator previous(); + abstract @NonNull AbstractExplicitGenerator previous(); - abstract @Nullable AbstractExplicitGenerator original(); + abstract @Nullable AbstractExplicitGenerator original(); abstract ToStringHelper addToStringAttributes(ToStringHelper helper);