From bfad05606e2defc1a376921f1b82781abb4a233b Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 18 Dec 2019 09:48:31 +0100 Subject: [PATCH] Deprecate Types.augmentableTypeFor() This method has a mirror in BindingTypes, which is a more appropriate place for the definition. Deprecate the method for removal and redirect it to BindingTypes.augmentation(). Change-Id: I462a2fe25f0b53cca0619c72aac7a1e602718143 Signed-off-by: Robert Varga (cherry picked from commit a07668d09b87d8f671e774a13583a3c3c0b41369) --- .../mdsal/binding/model/util/BindingTypes.java | 3 ++- .../org/opendaylight/mdsal/binding/model/util/Types.java | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/mdsal/binding/model/util/BindingTypes.java b/binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/mdsal/binding/model/util/BindingTypes.java index 725bbb4af0..250ca03e22 100644 --- a/binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/mdsal/binding/model/util/BindingTypes.java +++ b/binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/mdsal/binding/model/util/BindingTypes.java @@ -11,6 +11,7 @@ import static org.opendaylight.mdsal.binding.model.util.Types.parameterizedTypeF import static org.opendaylight.mdsal.binding.model.util.Types.typeForClass; import com.google.common.annotations.VisibleForTesting; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.mdsal.binding.model.api.ConcreteType; import org.opendaylight.mdsal.binding.model.api.JavaTypeName; import org.opendaylight.mdsal.binding.model.api.ParameterizedType; @@ -143,7 +144,7 @@ public final class BindingTypes { * @return A parameterized type corresponding to {@code Augmentable} * @throws NullPointerException if {@code type} is null */ - public static ParameterizedType augmentable(final Type type) { + public static @NonNull ParameterizedType augmentable(final Type type) { return parameterizedTypeFor(AUGMENTABLE, type); } diff --git a/binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/mdsal/binding/model/util/Types.java b/binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/mdsal/binding/model/util/Types.java index 82e4b422d1..a5166c3e64 100644 --- a/binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/mdsal/binding/model/util/Types.java +++ b/binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/mdsal/binding/model/util/Types.java @@ -24,6 +24,7 @@ import java.util.Map; import java.util.Objects; 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.BaseTypeWithRestrictions; import org.opendaylight.mdsal.binding.model.api.ConcreteType; @@ -33,7 +34,6 @@ import org.opendaylight.mdsal.binding.model.api.Restrictions; import org.opendaylight.mdsal.binding.model.api.Type; import org.opendaylight.mdsal.binding.model.api.WildcardType; import org.opendaylight.yangtools.concepts.Builder; -import org.opendaylight.yangtools.yang.binding.Augmentable; import org.opendaylight.yangtools.yang.binding.Augmentation; import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint; import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint; @@ -237,10 +237,11 @@ public final class Types { * @return ParametrizedType representation of raw type * Augmentable with actual parameter * valueType + * @deprecated Use {@link BindingTypes#augmentable(Type)} instead. */ - public static ParameterizedType augmentableTypeFor(final Type valueType) { - final Type augmentable = typeForClass(Augmentable.class); - return parameterizedTypeFor(augmentable, valueType); + @Deprecated + public static @NonNull ParameterizedType augmentableTypeFor(final Type valueType) { + return BindingTypes.augmentable(valueType); } /** -- 2.36.6