Remove DerivedTypes.isInt8() and friends 06/65306/4
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 8 Nov 2017 11:18:36 +0000 (12:18 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 9 Nov 2017 09:36:44 +0000 (10:36 +0100)
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 <robert.varga@pantheon.tech>
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseTypes.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypes.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/type/TypeTest.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ext/package-info.java

index ab2f54e2c4912518d2c63460ca6b8a6a4d1223aa..cb3dc5227e0ebaef591ea50602c025b444cd77aa 100644 (file)
@@ -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.
index 5b2a3b69f674617daf021b657cb1c58e1d9a8564..e8c7eafe3d789306136200634e19a8e4fa72c5da 100644 (file)
@@ -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<BinaryTypeDefinition> derivedBinaryBuilder(
             @Nonnull final BinaryTypeDefinition baseType, @Nonnull final SchemaPath path) {
         return new DerivedTypeBuilder<BinaryTypeDefinition>(baseType, path) {
index 2fd472c24cbc9d61078725f0fa6536950657e9e1..ec173dc3986953365d11ad4ef9f34768d99d599f 100644 (file)
@@ -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
index 76b360ae849e7f85ce70da3aa3773fec46678f00..12179e3355e5bc3d813b517592ac31b3e81c86a8 100644 (file)
@@ -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