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.type.IntegerTypeDefinition;
14 import org.opendaylight.controller.yang.model.api.type.RangeConstraint;
17 * Implementation of Yang int64 built-in type. <br>
18 * int64 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.
19 * The Java counterpart of Yang int64 built-in type is
23 public class Int64 extends AbstractSignedInteger {
25 private static final QName name = BaseTypes.constructQName("int64");
26 private Long defaultValue = null;
27 private static final String description =
28 "int64 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.";
31 super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
34 public Int64(final Long defaultValue) {
35 super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
36 this.defaultValue = defaultValue;
39 public Int64(final List<RangeConstraint> rangeStatements,
40 final String units, final Long defaultValue) {
41 super(name, description, rangeStatements, units);
42 this.defaultValue = defaultValue;
48 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
51 public IntegerTypeDefinition getBaseType() {
58 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
61 public Object getDefaultValue() {
66 public int hashCode() {
68 int result = super.hashCode();
69 result = prime * result
70 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
75 public boolean equals(Object obj) {
79 if (!super.equals(obj)) {
82 if (getClass() != obj.getClass()) {
85 Int64 other = (Int64) obj;
86 if (defaultValue == null) {
87 if (other.defaultValue != null) {
90 } else if (!defaultValue.equals(other.defaultValue)) {
97 public String toString() {
98 StringBuilder builder = new StringBuilder();
99 builder.append("Int64 [defaultValue=");
100 builder.append(defaultValue);
101 builder.append(", AbstractInteger=");
102 builder.append(super.toString());
104 return builder.toString();