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 int64 built-in type. <br>
19 * int64 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.
20 * The Java counterpart of Yang int64 built-in type is
24 public final class Int64 extends AbstractSignedInteger {
26 private static final QName name = BaseTypes.constructQName("int64");
27 private Long defaultValue = null;
28 private static final String description =
29 "int64 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.";
30 private final IntegerTypeDefinition baseType;
33 super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
37 public Int64(final SchemaPath path) {
38 super(path, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
39 this.baseType = new Int64();
42 public Int64(final SchemaPath path, final Long defaultValue) {
43 super(path, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
44 this.baseType = new Int64();
45 this.defaultValue = defaultValue;
48 public Int64(final SchemaPath path, final List<RangeConstraint> rangeStatements,
49 final String units, final Long defaultValue) {
50 super(path, name, description, rangeStatements, units);
51 this.baseType = new Int64();
52 this.defaultValue = defaultValue;
58 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
61 public IntegerTypeDefinition getBaseType() {
68 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
71 public Object getDefaultValue() {
76 public int hashCode() {
78 int result = super.hashCode();
79 result = prime * result
80 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
85 public boolean equals(Object obj) {
89 if (!super.equals(obj)) {
92 if (getClass() != obj.getClass()) {
95 Int64 other = (Int64) obj;
96 if (defaultValue == null) {
97 if (other.defaultValue != null) {
100 } else if (!defaultValue.equals(other.defaultValue)) {
107 public String toString() {
108 StringBuilder builder = new StringBuilder();
109 builder.append("Int64 [defaultValue=");
110 builder.append(defaultValue);
111 builder.append(", AbstractInteger=");
112 builder.append(super.toString());
114 return builder.toString();