Refactored implementation of getBaseType method for yang built-in types.
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / Int8.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.model.util;
9
10 import org.opendaylight.yangtools.yang.common.QName;
11
12 /**
13  * Implementation of Yang int8 built-in type. <br>
14  * int8 represents integer values between -128 and 127, inclusively. The Java
15  * counterpart of Yang int8 built-in type is {@link Byte}.
16  *
17  * @see AbstractSignedInteger
18  */
19 public final class Int8 extends AbstractSignedInteger {
20     private static Int8 instance;
21     private static final QName NAME = BaseTypes.constructQName("int8");
22     private static final String DESCRIPTION = "represents integer values between -128 and 127, inclusively.";
23
24     private Int8() {
25         super(NAME, DESCRIPTION, Byte.MIN_VALUE, Byte.MAX_VALUE, "");
26     }
27
28     public static Int8 getInstance() {
29         if (instance == null) {
30             instance = new Int8();
31         }
32         return instance;
33     }
34
35     @Override
36     public Object getDefaultValue() {
37         return null;
38     }
39
40     @Override
41     public String toString() {
42         return "type " + NAME;
43     }
44
45 }