2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.controller.model.util;
\r
10 import java.util.List;
\r
12 import org.opendaylight.controller.model.api.type.IntegerTypeDefinition;
\r
13 import org.opendaylight.controller.model.api.type.RangeConstraint;
\r
14 import org.opendaylight.controller.yang.common.QName;
\r
17 * Implementation of Yang int64 built-in type. <br>
\r
18 * int64 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.
\r
19 * The Java counterpart of Yang int64 built-in type is
\r
23 public class Int64 extends AbstractSignedInteger {
\r
25 private static final QName name = BaseTypes.constructQName("int64");
\r
26 private Long defaultValue = null;
\r
27 private static final String description =
\r
28 "int64 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.";
\r
31 super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
\r
34 public Int64(final Long defaultValue) {
\r
35 super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
\r
36 this.defaultValue = defaultValue;
\r
39 public Int64(final List<RangeConstraint> rangeStatements,
\r
40 final String units, final Long defaultValue) {
\r
41 super(name, description, rangeStatements, units);
\r
42 this.defaultValue = defaultValue;
\r
48 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
\r
51 public IntegerTypeDefinition getBaseType() {
\r
58 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
\r
61 public Object getDefaultValue() {
\r
62 return defaultValue;
\r
66 public int hashCode() {
\r
67 final int prime = 31;
\r
68 int result = super.hashCode();
\r
69 result = prime * result
\r
70 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
\r
75 public boolean equals(Object obj) {
\r
79 if (!super.equals(obj)) {
\r
82 if (getClass() != obj.getClass()) {
\r
85 Int64 other = (Int64) obj;
\r
86 if (defaultValue == null) {
\r
87 if (other.defaultValue != null) {
\r
90 } else if (!defaultValue.equals(other.defaultValue)) {
\r
97 public String toString() {
\r
98 StringBuilder builder = new StringBuilder();
\r
99 builder.append("Int64 [defaultValue=");
\r
100 builder.append(defaultValue);
\r
101 builder.append(", AbstractInteger=");
\r
102 builder.append(super.toString());
\r
103 builder.append("]");
\r
104 return builder.toString();
\r