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.UnsignedIntegerTypeDefinition;
15 * Implementation of Yang uint8 built-in type.
17 * uint8 represents integer values between 0 and 255, inclusively. The Java counterpart of
18 * Yang uint8 built-in type is {@link Short}.
20 * @see AbstractUnsignedInteger
22 public final class Uint8 extends AbstractUnsignedInteger {
24 private static final QName name = BaseTypes.constructQName("uint8");
25 private final Short defaultValue = null;
26 private static final String description =
27 "uint8 represents integer values between 0 and 255, inclusively.";
28 private final UnsignedIntegerTypeDefinition baseType;
30 public Uint8(final SchemaPath path) {
31 super(path, name, description, Short.MIN_VALUE, Short.MAX_VALUE, "");
38 * @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
41 public UnsignedIntegerTypeDefinition getBaseType() {
48 * @see 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 Uint8 other = (Uint8) 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("Uint8 [defaultValue=");
90 builder.append(defaultValue);
91 builder.append(", AbstractInteger=");
92 builder.append(super.toString());
94 return builder.toString();