Remove SchemaPath from TypeDefinition implementations
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / type / BaseTypes.java
index 9e752cbac65dfe2b20f07f7c48e7a82cc654309a..f349944d464ea89744c05c2f26beb72ba9cc1a55 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.yangtools.yang.model.util.type;
 
 import com.google.common.annotations.Beta;
 import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition;
@@ -63,28 +63,28 @@ public final class BaseTypes {
         return BaseBinaryType.INSTANCE;
     }
 
-    public static @NonNull BitsTypeBuilder bitsTypeBuilder(final SchemaPath path) {
-        return new BitsTypeBuilder(path);
+    public static @NonNull BitsTypeBuilder bitsTypeBuilder(final QName qname) {
+        return new BitsTypeBuilder(qname);
     }
 
     public static @NonNull BooleanTypeDefinition booleanType() {
         return BaseBooleanType.INSTANCE;
     }
 
-    public static @NonNull DecimalTypeBuilder decimalTypeBuilder(final SchemaPath path) {
-        return new DecimalTypeBuilder(path);
+    public static @NonNull DecimalTypeBuilder decimalTypeBuilder(final QName qname) {
+        return new DecimalTypeBuilder(qname);
     }
 
     public static @NonNull EmptyTypeDefinition emptyType() {
         return BaseEmptyType.INSTANCE;
     }
 
-    public static @NonNull EnumerationTypeBuilder enumerationTypeBuilder(final SchemaPath path) {
-        return new EnumerationTypeBuilder(path);
+    public static @NonNull EnumerationTypeBuilder enumerationTypeBuilder(final QName qname) {
+        return new EnumerationTypeBuilder(qname);
     }
 
-    public static @NonNull IdentityrefTypeBuilder identityrefTypeBuilder(final SchemaPath path) {
-        return new IdentityrefTypeBuilder(path);
+    public static @NonNull IdentityrefTypeBuilder identityrefTypeBuilder(final QName qname) {
+        return new IdentityrefTypeBuilder(qname);
     }
 
     public static @NonNull InstanceIdentifierTypeDefinition instanceIdentifierType() {
@@ -95,131 +95,46 @@ public final class BaseTypes {
         return BaseInt8Type.INSTANCE;
     }
 
-    /**
-     * Check if a particular type definition represents the built-in int8 type.
-     *
-     * @param type Type definition
-     * @return True if the definition is the built-in int8 type.
-     */
-    public static boolean isInt8(final TypeDefinition<?> type) {
-        return BaseInt8Type.INSTANCE.getPath().equals(type.getPath());
-    }
-
     public static @NonNull Int16TypeDefinition int16Type() {
         return BaseInt16Type.INSTANCE;
     }
 
-    /**
-     * Check if a particular type definition represents the built-in int16 type.
-     *
-     * @param type Type definition
-     * @return True if the definition is the built-in int16 type.
-     */
-    public static boolean isInt16(final TypeDefinition<?> type) {
-        return BaseInt16Type.INSTANCE.getPath().equals(type.getPath());
-    }
-
     public static @NonNull Int32TypeDefinition int32Type() {
         return BaseInt32Type.INSTANCE;
     }
 
-    /**
-     * Check if a particular type definition represents the built-in int32 type.
-     *
-     * @param type Type definition
-     * @return True if the definition is the built-in int32 type.
-     */
-
-    public static boolean isInt32(final TypeDefinition<?> type) {
-        return BaseInt32Type.INSTANCE.getPath().equals(type.getPath());
-    }
-
     public static @NonNull Int64TypeDefinition int64Type() {
         return BaseInt64Type.INSTANCE;
     }
 
-    /**
-     * Check if a particular type definition represents the built-in int64 type.
-     *
-     * @param type Type definition
-     * @return True if the definition is the built-in int64 type.
-     */
-    public static boolean isInt64(final TypeDefinition<?> type) {
-        return BaseInt64Type.INSTANCE.getPath().equals(type.getPath());
-    }
-
-    public static @NonNull LeafrefTypeBuilder leafrefTypeBuilder(final SchemaPath path) {
-        return new LeafrefTypeBuilder(path);
+    public static @NonNull LeafrefTypeBuilder leafrefTypeBuilder(final QName qname) {
+        return new LeafrefTypeBuilder(qname);
     }
 
     public static @NonNull StringTypeDefinition stringType() {
         return BaseStringType.INSTANCE;
     }
 
-    public static UnionTypeBuilder unionTypeBuilder(final SchemaPath path) {
-        return new UnionTypeBuilder(path);
+    public static UnionTypeBuilder unionTypeBuilder(final QName qname) {
+        return new UnionTypeBuilder(qname);
     }
 
     public static @NonNull Uint8TypeDefinition uint8Type() {
         return BaseUint8Type.INSTANCE;
     }
 
-    /**
-     * 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.
-     * @throws NullPointerException if type is null
-     */
-    public static boolean isUint8(final @NonNull TypeDefinition<?> type) {
-        return BaseUint8Type.INSTANCE.getPath().equals(type.getPath());
-    }
-
     public static @NonNull Uint16TypeDefinition uint16Type() {
         return BaseUint16Type.INSTANCE;
     }
 
-    /**
-     * 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.
-     * @throws NullPointerException if type is null
-     */
-    public static boolean isUint16(final @NonNull TypeDefinition<?> type) {
-        return BaseUint16Type.INSTANCE.getPath().equals(type.getPath());
-    }
-
     public static @NonNull Uint32TypeDefinition uint32Type() {
         return BaseUint32Type.INSTANCE;
     }
 
-    /**
-     * 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.
-     * @throws NullPointerException if type is null
-     */
-    public static boolean isUint32(final @NonNull TypeDefinition<?> type) {
-        return BaseUint32Type.INSTANCE.getPath().equals(type.getPath());
-    }
-
     public static @NonNull Uint64TypeDefinition uint64Type() {
         return BaseUint64Type.INSTANCE;
     }
 
-    /**
-     * 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.
-     * @throws NullPointerException if type is null
-     */
-    public static boolean isUint64(final @NonNull TypeDefinition<?> type) {
-        return BaseUint64Type.INSTANCE.getPath().equals(type.getPath());
-    }
-
     /**
      * Return the base type of a particular type. This method performs recursive lookup through the type's base type
      * until it finds the last element and returns it. If the argument is already the base type, it is returned as is.