2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.yang.model.util;
10 import org.opendaylight.controller.yang.common.QName;
11 import org.opendaylight.controller.yang.model.api.SchemaPath;
12 import org.opendaylight.controller.yang.model.api.type.IntegerTypeDefinition;
15 * Implementation of Yang int16 built-in type. <br>
16 * int16 represents integer values between -32768 and 32767, inclusively. The
17 * Java counterpart of Yang int16 built-in type is {@link Short}.
19 * @see AbstractSignedInteger
21 public final class Int16 extends AbstractSignedInteger {
22 private static final QName name = BaseTypes.constructQName("int16");
23 private final Short defaultValue = null;
24 private static final String description = "int16 represents integer values between -32768 and 32767, inclusively.";
25 private final IntegerTypeDefinition baseType;
27 public Int16(final SchemaPath path) {
28 super(path, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
34 public IntegerTypeDefinition getBaseType() {
39 public Object getDefaultValue() {
44 public int hashCode() {
46 int result = super.hashCode();
47 result = prime * result
48 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
53 public boolean equals(Object obj) {
57 if (!super.equals(obj)) {
60 if (getClass() != obj.getClass()) {
63 Int16 other = (Int16) obj;
64 if (defaultValue == null) {
65 if (other.defaultValue != null) {
68 } else if (!defaultValue.equals(other.defaultValue)) {
75 public String toString() {
76 StringBuilder builder = new StringBuilder();
77 builder.append("Int16 [defaultValue=");
78 builder.append(defaultValue);
79 builder.append(", AbstractInteger=");
80 builder.append(super.toString());
82 return builder.toString();