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.type.IntegerTypeDefinition;
14 import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
17 * Implementation of Yang int16 built-in type. <br>
18 * int16 represents integer values between -32768 and 32767, inclusively. The
19 * Java counterpart of Yang int16 built-in type is {@link Short}.
21 * @see AbstractSignedInteger
23 public class Int16 extends AbstractSignedInteger {
25 private static final QName name = BaseTypes.constructQName("int16");
26 private Short defaultValue = null;
27 private static final String description =
28 "int16 represents integer values between -32768 and 32767, inclusively.";
31 super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
34 public Int16(final List<RangeConstraint> rangeStatements,
35 final String units, final Short defaultValue) {
36 super(name, description, rangeStatements, units);
37 this.defaultValue = defaultValue;
41 public IntegerTypeDefinition getBaseType() {
46 public Object getDefaultValue() {
51 public int hashCode() {
53 int result = super.hashCode();
54 result = prime * result
55 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
60 public boolean equals(Object obj) {
64 if (!super.equals(obj)) {
67 if (getClass() != obj.getClass()) {
70 Int16 other = (Int16) obj;
71 if (defaultValue == null) {
72 if (other.defaultValue != null) {
75 } else if (!defaultValue.equals(other.defaultValue)) {
82 public String toString() {
83 StringBuilder builder = new StringBuilder();
84 builder.append("Int16 [defaultValue=");
85 builder.append(defaultValue);
86 builder.append(", AbstractInteger=");
87 builder.append(super.toString());
89 return builder.toString();