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.IntegerTypeDefinition;
15 import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
18 * Implementation of Yang int32 built-in type. <br>
19 * int32 represents integer values between -2147483648 and 2147483647,
20 * inclusively. The Java counterpart of Yang int32 built-in type is
23 * @see AbstractSignedInteger
26 public final class Int32 extends AbstractSignedInteger {
28 private static final QName name = BaseTypes.constructQName("int32");
29 private Integer defaultValue = null;
30 private static final String description = "int32 represents integer values between -2147483648 and 2147483647, inclusively.";
31 private final IntegerTypeDefinition baseType;
34 super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
38 public Int32(final SchemaPath path) {
39 super(path, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
40 this.baseType = new Int32();
43 public Int32(final SchemaPath path, final Integer defaultValue) {
44 super(path, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
45 this.baseType = new Int32();
46 this.defaultValue = defaultValue;
49 public Int32(final SchemaPath path,
50 final List<RangeConstraint> rangeStatements, final String units,
51 final Integer defaultValue) {
52 super(path, name, description, rangeStatements, units);
53 this.baseType = new Int32();
54 this.defaultValue = defaultValue;
61 * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
64 public IntegerTypeDefinition getBaseType() {
72 * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
76 public Object getDefaultValue() {
81 public int hashCode() {
83 int result = super.hashCode();
84 result = prime * result
85 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
90 public boolean equals(Object obj) {
94 if (!super.equals(obj)) {
97 if (getClass() != obj.getClass()) {
100 Int32 other = (Int32) obj;
101 if (defaultValue == null) {
102 if (other.defaultValue != null) {
105 } else if (!defaultValue.equals(other.defaultValue)) {
112 public String toString() {
113 StringBuilder builder = new StringBuilder();
114 builder.append("Int32 [defaultValue=");
115 builder.append(defaultValue);
116 builder.append(", AbstractInteger=");
117 builder.append(super.toString());
119 return builder.toString();