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 int64 built-in type. <br>
20 * int64 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.
21 * The Java counterpart of Yang int64 built-in type is
25 public class Int64 extends AbstractSignedInteger {
27 private static final QName name = BaseTypes.constructQName("int64");
28 private Long defaultValue = null;
29 private static final String description =
30 "int64 represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.";
32 public Int64(final List<String> actualPath, final URI namespace,
33 final Date revision) {
34 super(actualPath, namespace, revision, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
37 public Int64(final List<String> actualPath, final URI namespace,
38 final Date revision, final Long defaultValue) {
39 super(actualPath, namespace, revision, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
40 this.defaultValue = defaultValue;
43 public Int64(final List<String> actualPath, final URI namespace,
44 final Date revision, final List<RangeConstraint> rangeStatements,
45 final String units, final Long defaultValue) {
46 super(actualPath, namespace, revision, name, description, rangeStatements, units);
47 this.defaultValue = defaultValue;
53 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
56 public IntegerTypeDefinition getBaseType() {
63 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
66 public Object getDefaultValue() {
71 public int hashCode() {
73 int result = super.hashCode();
74 result = prime * result
75 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
80 public boolean equals(Object obj) {
84 if (!super.equals(obj)) {
87 if (getClass() != obj.getClass()) {
90 Int64 other = (Int64) obj;
91 if (defaultValue == null) {
92 if (other.defaultValue != null) {
95 } else if (!defaultValue.equals(other.defaultValue)) {
102 public String toString() {
103 StringBuilder builder = new StringBuilder();
104 builder.append("Int64 [defaultValue=");
105 builder.append(defaultValue);
106 builder.append(", AbstractInteger=");
107 builder.append(super.toString());
109 return builder.toString();