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.RangeConstraint;
14 import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefinition;
17 * Implementation of Yang uint32 built-in type. <br>
18 * uint16 represents integer values between 0 and 65535, inclusively. The Java
19 * counterpart of Yang uint32 built-in type is {@link Integer}.
22 public class Uint16 extends AbstractUnsignedInteger {
24 private static final QName name = BaseTypes.constructQName("uint16");
25 private Integer defaultValue = null;
26 private static final String description = "uint16 represents integer values between 0 and 65535, inclusively.";
29 super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
32 public Uint16(final Integer defaultValue) {
33 super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
34 this.defaultValue = defaultValue;
37 public Uint16(final List<RangeConstraint> rangeStatements,
38 final String units, final Integer defaultValue) {
39 super(name, description, rangeStatements, units);
40 this.defaultValue = defaultValue;
47 * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
50 public UnsignedIntegerTypeDefinition getBaseType() {
58 * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
62 public Object getDefaultValue() {
67 public int hashCode() {
69 int result = super.hashCode();
70 result = prime * result
71 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
76 public boolean equals(Object obj) {
80 if (!super.equals(obj)) {
83 if (getClass() != obj.getClass()) {
86 Uint16 other = (Uint16) obj;
87 if (defaultValue == null) {
88 if (other.defaultValue != null) {
91 } else if (!defaultValue.equals(other.defaultValue)) {
98 public String toString() {
99 StringBuilder builder = new StringBuilder();
100 builder.append("Uint16 [defaultValue=");
101 builder.append(defaultValue);
102 builder.append(", AbstractInteger=");
103 builder.append(super.toString());
105 return builder.toString();