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.";
31 private final IntegerTypeDefinition baseType;
34 super(name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
38 public Int64(final List<String> actualPath, final URI namespace,
39 final Date revision) {
40 super(actualPath, namespace, revision, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
41 this.baseType = new Int64();
44 public Int64(final List<String> actualPath, final URI namespace,
45 final Date revision, final Long defaultValue) {
46 super(actualPath, namespace, revision, name, description, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
47 this.baseType = new Int64();
48 this.defaultValue = defaultValue;
51 public Int64(final List<String> actualPath, final URI namespace,
52 final Date revision, final List<RangeConstraint> rangeStatements,
53 final String units, final Long defaultValue) {
54 super(actualPath, namespace, revision, name, description, rangeStatements, units);
55 this.baseType = new Int64();
56 this.defaultValue = defaultValue;
62 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
65 public IntegerTypeDefinition getBaseType() {
72 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
75 public Object getDefaultValue() {
80 public int hashCode() {
82 int result = super.hashCode();
83 result = prime * result
84 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
89 public boolean equals(Object obj) {
93 if (!super.equals(obj)) {
96 if (getClass() != obj.getClass()) {
99 Int64 other = (Int64) obj;
100 if (defaultValue == null) {
101 if (other.defaultValue != null) {
104 } else if (!defaultValue.equals(other.defaultValue)) {
111 public String toString() {
112 StringBuilder builder = new StringBuilder();
113 builder.append("Int64 [defaultValue=");
114 builder.append(defaultValue);
115 builder.append(", AbstractInteger=");
116 builder.append(super.toString());
118 return builder.toString();