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 java.util.List;
12 import org.opendaylight.controller.yang.common.QName;
13 import org.opendaylight.controller.yang.model.api.SchemaPath;
14 import org.opendaylight.controller.yang.model.api.type.IntegerTypeDefinition;
15 import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
18 * Implementation of Yang int16 built-in type. <br>
19 * int16 represents integer values between -32768 and 32767, inclusively. The
20 * Java counterpart of Yang int16 built-in type is {@link Short}.
22 * @see AbstractSignedInteger
24 public final class Int16 extends AbstractSignedInteger {
26 private static final QName name = BaseTypes.constructQName("int16");
27 private Short defaultValue = null;
28 private static final String description = "int16 represents integer values between -32768 and 32767, inclusively.";
29 private final IntegerTypeDefinition baseType;
32 super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
36 public Int16(final SchemaPath path) {
37 super(path, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
38 this.baseType = new Int16();
42 public Int16(final SchemaPath path,
43 final List<RangeConstraint> rangeStatements, final String units,
44 final Short defaultValue) {
45 super(path, name, description, rangeStatements, units);
46 this.defaultValue = defaultValue;
47 this.baseType = new Int16();
51 public IntegerTypeDefinition getBaseType() {
56 public Object getDefaultValue() {
61 public int hashCode() {
63 int result = super.hashCode();
64 result = prime * result
65 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
70 public boolean equals(Object obj) {
74 if (!super.equals(obj)) {
77 if (getClass() != obj.getClass()) {
80 Int16 other = (Int16) obj;
81 if (defaultValue == null) {
82 if (other.defaultValue != null) {
85 } else if (!defaultValue.equals(other.defaultValue)) {
92 public String toString() {
93 StringBuilder builder = new StringBuilder();
94 builder.append("Int16 [defaultValue=");
95 builder.append(defaultValue);
96 builder.append(", AbstractInteger=");
97 builder.append(super.toString());
99 return builder.toString();