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.RangeConstraint;
16 import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefinition;
19 * Implementation of Yang uint32 built-in type. <br>
20 * uint16 represents integer values between 0 and 65535, inclusively. The Java
21 * counterpart of Yang uint32 built-in type is {@link Integer}.
24 public class Uint16 extends AbstractUnsignedInteger {
26 private static final QName name = BaseTypes.constructQName("uint16");
27 private Integer defaultValue = null;
28 private static final String description = "uint16 represents integer values between 0 and 65535, inclusively.";
30 public Uint16(final List<String> actualPath,
31 final URI namespace, final Date revision) {
32 super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
35 public Uint16(final List<String> actualPath,
36 final URI namespace, final Date revision, final Integer defaultValue) {
37 super(actualPath, namespace, revision, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
38 this.defaultValue = defaultValue;
41 public Uint16(final List<String> actualPath,
42 final URI namespace, final Date revision, final List<RangeConstraint> rangeStatements,
43 final String units, final Integer defaultValue) {
44 super(actualPath, namespace, revision, name, description, rangeStatements, units);
45 this.defaultValue = defaultValue;
52 * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
55 public UnsignedIntegerTypeDefinition getBaseType() {
63 * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
67 public Object getDefaultValue() {
72 public int hashCode() {
74 int result = super.hashCode();
75 result = prime * result
76 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
81 public boolean equals(Object obj) {
85 if (!super.equals(obj)) {
88 if (getClass() != obj.getClass()) {
91 Uint16 other = (Uint16) obj;
92 if (defaultValue == null) {
93 if (other.defaultValue != null) {
96 } else if (!defaultValue.equals(other.defaultValue)) {
103 public String toString() {
104 StringBuilder builder = new StringBuilder();
105 builder.append("Uint16 [defaultValue=");
106 builder.append(defaultValue);
107 builder.append(", AbstractInteger=");
108 builder.append(super.toString());
110 return builder.toString();