*/
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;
}
}