Fixing sonar issues 4
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / EmptyType.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 java.util.Collections;
11 import java.util.List;
12
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
15 import org.opendaylight.yangtools.yang.model.api.Status;
16 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition;
18
19 public final class EmptyType implements EmptyTypeDefinition {
20     private static EmptyType instance;
21     private static final QName NAME = BaseTypes.constructQName("empty");
22     private static final SchemaPath PATH = new SchemaPath(Collections.singletonList(NAME), true);
23     private static final String DESCRIPTION = "The empty built-in type represents a leaf that does not have any value, it conveys information by its presence or absence.";
24     private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#page-131";
25
26     private EmptyType() {
27     }
28
29     public static EmptyType getInstance() {
30         if (instance == null) {
31             instance = new EmptyType();
32         }
33         return instance;
34     }
35
36     @Override
37     public EmptyTypeDefinition getBaseType() {
38         return this;
39     }
40
41     @Override
42     public String getUnits() {
43         return null;
44     }
45
46     @Override
47     public Object getDefaultValue() {
48         return null;
49     }
50
51     @Override
52     public QName getQName() {
53         return NAME;
54     }
55
56     @Override
57     public SchemaPath getPath() {
58         return PATH;
59     }
60
61     @Override
62     public String getDescription() {
63         return DESCRIPTION;
64     }
65
66     @Override
67     public String getReference() {
68         return REFERENCE;
69     }
70
71     @Override
72     public Status getStatus() {
73         return Status.CURRENT;
74     }
75
76     @Override
77     public List<UnknownSchemaNode> getUnknownSchemaNodes() {
78         return Collections.emptyList();
79     }
80
81     @Override
82     public String toString() {
83         return "type empty " + NAME;
84     }
85
86 }