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. <br>
16 * uint8 represents integer values between 0 and 255, inclusively.
18 * @see AbstractUnsignedInteger
20 public final class Uint8 extends AbstractUnsignedInteger {
21 public static final int MAX_VALUE = 255;
22 private static final QName name = BaseTypes.constructQName("uint8");
23 private final Short defaultValue = null;
24 private static final String description = "uint8 represents integer values between 0 and 255, inclusively.";
25 private final UnsignedIntegerTypeDefinition baseType;
27 public Uint8(final SchemaPath path) {
28 super(path, name, description, MAX_VALUE, "");
36 * org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
39 public UnsignedIntegerTypeDefinition 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 + ((defaultValue == null) ? 0 : defaultValue.hashCode());
64 public boolean equals(Object obj) {
68 if (!super.equals(obj)) {
71 if (getClass() != obj.getClass()) {
74 Uint8 other = (Uint8) obj;
75 if (defaultValue == null) {
76 if (other.defaultValue != null) {
79 } else if (!defaultValue.equals(other.defaultValue)) {
86 public String toString() {
87 StringBuilder builder = new StringBuilder();
88 builder.append("Uint8 [defaultValue=");
89 builder.append(defaultValue);
90 builder.append(", AbstractInteger=");
91 builder.append(super.toString());
93 return builder.toString();