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;
11 import java.util.Date;
12 import java.util.List;
14 import org.opendaylight.controller.yang.common.QName;
15 import org.opendaylight.controller.yang.model.api.type.IntegerTypeDefinition;
16 import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
19 * Implementation of Yang int16 built-in type. <br>
20 * int16 represents integer values between -32768 and 32767, inclusively. The
21 * Java counterpart of Yang int16 built-in type is {@link Short}.
23 * @see AbstractSignedInteger
25 public class Int16 extends AbstractSignedInteger {
27 private static final QName name = BaseTypes.constructQName("int16");
28 private Short defaultValue = null;
29 private static final String description =
30 "int16 represents integer values between -32768 and 32767, inclusively.";
32 public Int16(final List<String> actualPath, final URI namespace,
33 final Date revision) {
34 super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
37 public Int16(final List<String> actualPath, final URI namespace,
38 final Date revision, final List<RangeConstraint> rangeStatements,
39 final String units, final Short defaultValue) {
40 super(actualPath, namespace, revision, name, description, rangeStatements, units);
41 this.defaultValue = defaultValue;
45 public IntegerTypeDefinition getBaseType() {
50 public Object getDefaultValue() {
55 public int hashCode() {
57 int result = super.hashCode();
58 result = prime * result
59 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
64 public boolean equals(Object obj) {
68 if (!super.equals(obj)) {
71 if (getClass() != obj.getClass()) {
74 Int16 other = (Int16) obj;
75 if (defaultValue == null) {
76 if (other.defaultValue != null) {
79 } else if (!defaultValue.equals(other.defaultValue)) {
86 public String toString() {
87 StringBuilder builder = new StringBuilder();
88 builder.append("Int16 [defaultValue=");
89 builder.append(defaultValue);
90 builder.append(", AbstractInteger=");
91 builder.append(super.toString());
93 return builder.toString();