From 4567d6b975bcc8bb5729fd1cc1bff5d342f6a984 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 8 Nov 2017 12:18:36 +0100 Subject: [PATCH] Remove DerivedTypes.isInt8() and friends These methods are no longer needed, as their equivalent can be performed via a simple instanceof check. Remove them. Change-Id: Ieb92ad6497a78b6777dd49b5d148b678c1633f20 Signed-off-by: Robert Varga --- .../yang/model/util/type/BaseTypes.java | 12 +- .../yang/model/util/type/DerivedTypes.java | 114 ------------------ .../yang/model/util/type/TypeTest.java | 8 -- .../parser/stmt/rfc6020/ext/package-info.java | 7 +- 4 files changed, 7 insertions(+), 134 deletions(-) diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseTypes.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseTypes.java index ab2f54e2c4..cb3dc5227e 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseTypes.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseTypes.java @@ -165,8 +165,7 @@ public final class BaseTypes { } /** - * Check if a particular type is the base type for uint8. Unlike {@link DerivedTypes#isUint8(TypeDefinition)}, - * this method does not perform recursive base type lookup. + * Check if a particular type is the base type for uint8. * * @param type The type to check * @return If the type corresponds to the base uint8 type. @@ -181,8 +180,7 @@ public final class BaseTypes { } /** - * Check if a particular type is the base type for uint16. Unlike {@link DerivedTypes#isUint16(TypeDefinition)}, - * this method does not perform recursive base type lookup. + * Check if a particular type is the base type for uint16. * * @param type The type to check * @return If the type corresponds to the base uint16 type. @@ -197,8 +195,7 @@ public final class BaseTypes { } /** - * Check if a particular type is the base type for uint32. Unlike {@link DerivedTypes#isUint32(TypeDefinition)}, - * this method does not perform recursive base type lookup. + * Check if a particular type is the base type for uint32. * * @param type The type to check * @return If the type corresponds to the base uint32 type. @@ -213,8 +210,7 @@ public final class BaseTypes { } /** - * Check if a particular type is the base type for uint64. Unlike {@link DerivedTypes#isUint64(TypeDefinition)}, - * this method does not perform recursive base type lookup. + * Check if a particular type is the base type for uint64. * * @param type The type to check * @return If the type corresponds to the base uint64 type. diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypes.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypes.java index 5b2a3b69f6..e8c7eafe3d 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypes.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypes.java @@ -7,8 +7,6 @@ */ package org.opendaylight.yangtools.yang.model.util.type; -import static java.util.Objects.requireNonNull; - import com.google.common.annotations.Beta; import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; @@ -94,118 +92,6 @@ public final class DerivedTypes { } } - /** - * Check if a particular type is itself, or is derived from, int8. - * - * @param type The type to check - * @return If the type belongs to the int8 type family. - * @throws NullPointerException if type is null - * - * @deprecated Use @{code type instanceof Int8TypeDefinition} instead. - */ - @Deprecated - public static boolean isInt8(@Nonnull final TypeDefinition type) { - return requireNonNull(type) instanceof Int8TypeDefinition; - } - - /** - * Check if a particular type is itself, or is derived from, int16. - * - * @param type The type to check - * @return If the type belongs to the int16 type family. - * @throws NullPointerException if type is null - * - * @deprecated Use @{code type instanceof Int16TypeDefinition} instead. - */ - @Deprecated - public static boolean isInt16(@Nonnull final TypeDefinition type) { - return requireNonNull(type) instanceof Int16TypeDefinition; - } - - /** - * Check if a particular type is itself, or is derived from, int32. - * - * @param type The type to check - * @return If the type belongs to the int32 type family. - * @throws NullPointerException if type is null - * - * @deprecated Use @{code type instanceof Int32TypeDefinition} instead. - */ - @Deprecated - public static boolean isInt32(@Nonnull final TypeDefinition type) { - return requireNonNull(type) instanceof Int32TypeDefinition; - } - - /** - * Check if a particular type is itself, or is derived from, int64. - * - * @param type The type to check - * @return If the type belongs to the int64 type family. - * @throws NullPointerException if type is null - * - * @deprecated Use @{code type instanceof Int64TypeDefinition} instead. - */ - @Deprecated - public static boolean isInt64(@Nonnull final TypeDefinition type) { - return requireNonNull(type) instanceof Int64TypeDefinition; - } - - /** - * Check if a particular type is itself, or is derived from, uint8. - * - * @param type The type to check - * @return If the type belongs to the uint8 type family. - * @throws NullPointerException if type is null - * - * @deprecated Use @{code type instanceof Uint8TypeDefinition} instead. - */ - @Deprecated - public static boolean isUint8(@Nonnull final TypeDefinition type) { - return requireNonNull(type) instanceof Uint8TypeDefinition; - } - - /** - * Check if a particular type is itself, or is derived from, uint16. - * - * @param type The type to check - * @return If the type belongs to the uint16 type family. - * @throws NullPointerException if type is null - * - * @deprecated Use @{code type instanceof Uint16TypeDefinition} instead. - */ - @Deprecated - public static boolean isUint16(@Nonnull final TypeDefinition type) { - return requireNonNull(type) instanceof Uint16TypeDefinition; - } - - /** - * Check if a particular type is itself, or is derived from, uint32. - * - * @param type The type to check - * @return If the type belongs to the uint32 type family. - * @throws NullPointerException if type is null - * - * @deprecated Use @{code type instanceof Uint32TypeDefinition} instead. - */ - @Deprecated - public static boolean isUint32(@Nonnull final TypeDefinition type) { - return requireNonNull(type) instanceof Uint32TypeDefinition; - } - - /** - * Check if a particular type is itself, or is derived from, uint64. - * - * @param type The type to check - * @return If the type belongs to the uint64 type family. - * @throws NullPointerException if type is null - * - * @deprecated Use @{code type instanceof Uint64TypeDefinition} instead. - */ - @Deprecated - public static boolean isUint64(@Nonnull final TypeDefinition type) { - return requireNonNull(type) instanceof Uint64TypeDefinition; - } - private static DerivedTypeBuilder derivedBinaryBuilder( @Nonnull final BinaryTypeDefinition baseType, @Nonnull final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { diff --git a/yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/type/TypeTest.java b/yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/type/TypeTest.java index 2fd472c24c..ec173dc398 100644 --- a/yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/type/TypeTest.java +++ b/yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/type/TypeTest.java @@ -395,14 +395,6 @@ public class TypeTest { assertEquals(Optional.empty(), abstractDerivedType.getDescription()); assertEquals(Optional.empty(), abstractDerivedType.getReference()); assertEquals(Status.CURRENT, abstractDerivedType.getStatus()); - assertFalse(DerivedTypes.isInt8(baseBinaryType1)); - assertFalse(DerivedTypes.isUint8(baseBinaryType1)); - assertFalse(DerivedTypes.isInt16(baseBinaryType1)); - assertFalse(DerivedTypes.isUint16(baseBinaryType1)); - assertFalse(DerivedTypes.isInt32(baseBinaryType1)); - assertFalse(DerivedTypes.isUint32(baseBinaryType1)); - assertFalse(DerivedTypes.isInt64(baseBinaryType1)); - assertFalse(DerivedTypes.isUint64(baseBinaryType1)); } @Test diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ext/package-info.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ext/package-info.java index 76b360ae84..12179e3355 100644 --- a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ext/package-info.java +++ b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ext/package-info.java @@ -6,10 +6,9 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ /** - * Provides builders and classes necessary for customization of yang stmt parser + * Provides builders and classes necessary for customization of YANG stmt parser * (e.g. add support for an third-party extension etc.). - * {@link CustomStatementParserBuilder} is designed for building a custom yang - * statement parser with extended support for a custom statement or yang - * extension. + * {@link org.opendaylight.yangtools.yang.parser.stmt.rfc6020.ext.CustomStatementParserBuilder} is designed for building + * a custom YANG statement parser with extended support for a custom statement or YANG extension. */ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.ext; \ No newline at end of file -- 2.36.6