Bug 6414: Fixed DataNodeIterator's traverseModule method
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / Uint16.java
index 0a45f8aa0b5fa33be7370972dd42e0b780c41558..afa95fea2d691656c75a058793cd24a0d4c5588d 100644 (file)
@@ -7,90 +7,38 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
+import org.opendaylight.yangtools.concepts.Immutable;
 
 /**
- * Implementation of Yang uint32 built-in type. <br>
+ * Implementation of Yang uint16 built-in type. <br>
  * uint16 represents integer values between 0 and 65535, inclusively. The Java
- * counterpart of Yang uint32 built-in type is {@link Integer}.
+ * counterpart of Yang uint16 built-in type is {@link Integer}.
  *
+ * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#uint16Type()} instead
  */
-public final class Uint16 extends AbstractUnsignedInteger {
+@Deprecated
+public final class Uint16 extends AbstractUnsignedInteger implements Immutable {
     public static final int MAX_VALUE = 65535;
-    private static final QName name = BaseTypes.constructQName("uint16");
-    private Integer defaultValue = null;
-    private static final String description = "uint16 represents integer values between 0 and 65535, inclusively.";
-    private final UnsignedIntegerTypeDefinition baseType;
+    private static final String DESCRIPTION = "uint16 represents integer values between 0 and 65535, inclusively.";
 
-    public Uint16(final SchemaPath path) {
-        super(path, name, description, MAX_VALUE, "");
-        this.baseType = this;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
-     */
-    @Override
-    public UnsignedIntegerTypeDefinition getBaseType() {
-        return baseType;
-    }
+    private static final Uint16 INSTANCE = new Uint16();
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
-     * ()
-     */
-    @Override
-    public Object getDefaultValue() {
-        return defaultValue;
+    private Uint16() {
+        super(BaseTypes.UINT16_QNAME, DESCRIPTION, MAX_VALUE, "");
     }
 
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + ((defaultValue == null) ? 0 : defaultValue.hashCode());
-        return result;
+    public static Uint16 getInstance() {
+        return INSTANCE;
     }
 
     @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        Uint16 other = (Uint16) obj;
-        if (defaultValue == null) {
-            if (other.defaultValue != null) {
-                return false;
-            }
-        } else if (!defaultValue.equals(other.defaultValue)) {
-            return false;
-        }
-        return true;
+    public Object getDefaultValue() {
+        return null;
     }
 
     @Override
     public String toString() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("Uint16 [defaultValue=");
-        builder.append(defaultValue);
-        builder.append(", AbstractInteger=");
-        builder.append(super.toString());
-        builder.append("]");
-        return builder.toString();
+        return "type " + BaseTypes.UINT16_QNAME;
     }
 
 }