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 int32 built-in type. <br>
20 * int32 represents integer values between -2147483648 and 2147483647,
21 * inclusively. The Java counterpart of Yang int32 built-in type is
24 * @see AbstractSignedInteger
27 public class Int32 extends AbstractSignedInteger {
29 private static final QName name = BaseTypes.constructQName("int32");
30 private Integer defaultValue = null;
31 private static final String description =
32 "int32 represents integer values between -2147483648 and 2147483647, inclusively.";
33 private final IntegerTypeDefinition baseType;
36 super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
40 public Int32(final List<String> actualPath, final URI namespace,
41 final Date revision) {
42 super(actualPath, namespace, revision, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
43 this.baseType = new Int32();
46 public Int32(final List<String> actualPath, final URI namespace,
47 final Date revision, final Integer defaultValue) {
48 super(actualPath, namespace, revision, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
49 this.baseType = new Int32();
50 this.defaultValue = defaultValue;
53 public Int32(final List<String> actualPath, final URI namespace,
54 final Date revision, final List<RangeConstraint> rangeStatements,
55 final String units, final Integer defaultValue) {
56 super(actualPath, namespace, revision, name, description, rangeStatements, units);
57 this.baseType = new Int32();
58 this.defaultValue = defaultValue;
65 * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
68 public IntegerTypeDefinition getBaseType() {
76 * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
80 public Object getDefaultValue() {
85 public int hashCode() {
87 int result = super.hashCode();
88 result = prime * result
89 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
94 public boolean equals(Object obj) {
98 if (!super.equals(obj)) {
101 if (getClass() != obj.getClass()) {
104 Int32 other = (Int32) obj;
105 if (defaultValue == null) {
106 if (other.defaultValue != null) {
109 } else if (!defaultValue.equals(other.defaultValue)) {
116 public String toString() {
117 StringBuilder builder = new StringBuilder();
118 builder.append("Int32 [defaultValue=");
119 builder.append(defaultValue);
120 builder.append(", AbstractInteger=");
121 builder.append(super.toString());
123 return builder.toString();