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 org.opendaylight.controller.yang.common.QName;
11 import org.opendaylight.controller.yang.model.api.SchemaPath;
12 import org.opendaylight.controller.yang.model.api.type.IntegerTypeDefinition;
15 * Implementation of Yang int8 built-in type. <br>
16 * int8 represents integer values between -128 and 127, inclusively. The Java
17 * counterpart of Yang int8 built-in type is {@link Byte}.
19 * @see AbstractSignedInteger
21 public final class Int8 extends AbstractSignedInteger {
22 private static final QName name = BaseTypes.constructQName("int8");
23 private final Byte defaultValue = null;
24 private static final String description = "represents integer values between -128 and 127, inclusively.";
25 private final IntegerTypeDefinition baseType;
27 public Int8(final SchemaPath path) {
28 super(path, name, description, Byte.MIN_VALUE, Byte.MAX_VALUE, "");
36 * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
39 public IntegerTypeDefinition getBaseType() {
47 * org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue
51 public Object getDefaultValue() {
56 public int hashCode() {
58 int result = super.hashCode();
59 result = prime * result
60 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
65 public boolean equals(Object obj) {
69 if (!super.equals(obj)) {
72 if (getClass() != obj.getClass()) {
75 Int8 other = (Int8) obj;
76 if (defaultValue == null) {
77 if (other.defaultValue != null) {
80 } else if (!defaultValue.equals(other.defaultValue)) {
87 public String toString() {
88 StringBuilder builder = new StringBuilder();
89 builder.append("Int8 [defaultValue=");
90 builder.append(defaultValue);
91 builder.append(", AbstractInteger=");
92 builder.append(super.toString());
94 return builder.toString();