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.RangeConstraint;
15 import org.opendaylight.controller.yang.model.api.type.UnsignedIntegerTypeDefinition;
18 * Implementation of Yang uint32 built-in type. <br>
19 * uint32 represents integer values between 0 and 4294967295, inclusively. The
20 * Java counterpart of Yang uint32 built-in type is {@link Long}.
23 public final class Uint32 extends AbstractUnsignedInteger {
25 private static final QName name = BaseTypes.constructQName("uint32");
26 private Long defaultValue = null;
27 private static final String description = "uint32 represents integer values between 0 and 4294967295, inclusively.";
28 private final UnsignedIntegerTypeDefinition baseType;
31 super(name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
35 public Uint32(final SchemaPath path) {
36 super(path, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
37 this.baseType = new Uint32();
40 public Uint32(final SchemaPath path, final Long defaultValue) {
41 super(path, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
42 this.baseType = new Uint32();
43 this.defaultValue = defaultValue;
46 public Uint32(final SchemaPath path, final List<RangeConstraint> rangeStatements,
47 final String units, final Long defaultValue) {
48 super(path, name, description, rangeStatements, units);
49 this.baseType = new Uint32();
50 this.defaultValue = defaultValue;
57 * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
60 public UnsignedIntegerTypeDefinition getBaseType() {
68 * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
72 public Object getDefaultValue() {
77 public int hashCode() {
79 int result = super.hashCode();
80 result = prime * result
81 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
86 public boolean equals(Object obj) {
90 if (!super.equals(obj)) {
93 if (getClass() != obj.getClass()) {
96 Uint32 other = (Uint32) obj;
97 if (defaultValue == null) {
98 if (other.defaultValue != null) {
101 } else if (!defaultValue.equals(other.defaultValue)) {
108 public String toString() {
109 StringBuilder builder = new StringBuilder();
110 builder.append("Uint32 [defaultValue=");
111 builder.append(defaultValue);
112 builder.append(", AbstractInteger=");
113 builder.append(super.toString());
115 return builder.toString();