Merge "BUG-864: decrease log level when sorting and parsing modules"
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / BooleanType.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.BooleanTypeDefinition;
18
19 /**
20  * The <code>default</code> implementation of Boolean Type Definition interface.
21  *
22  * @see BooleanTypeDefinition
23  */
24 public final class BooleanType implements BooleanTypeDefinition {
25     private static final BooleanType INSTANCE = new BooleanType();
26     private static final SchemaPath PATH = SchemaPath.create(Collections.singletonList(BaseTypes.BOOLEAN_QNAME), true);
27     private static final String DESCRIPTION = "The boolean built-in type represents a boolean value.";
28     private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.5";
29     private static final String UNITS = "";
30
31     /**
32      * Default constructor with default value set to "false".
33      */
34     private BooleanType() {
35     }
36
37     public static BooleanType getInstance() {
38         return INSTANCE;
39     }
40
41     /*
42      * (non-Javadoc)
43      *
44      * @see
45      * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
46      */
47     @Override
48     public BooleanTypeDefinition getBaseType() {
49         return null;
50     }
51
52     /*
53      * (non-Javadoc)
54      *
55      * @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
56      */
57     @Override
58     public String getUnits() {
59         return UNITS;
60     }
61
62     /*
63      * (non-Javadoc)
64      *
65      * @see
66      * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
67      * ()
68      */
69     @Override
70     public Object getDefaultValue() {
71         return false;
72     }
73
74     /*
75      * (non-Javadoc)
76      *
77      * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
78      */
79     @Override
80     public QName getQName() {
81         return BaseTypes.BOOLEAN_QNAME;
82     }
83
84     /*
85      * (non-Javadoc)
86      *
87      * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
88      */
89     @Override
90     public SchemaPath getPath() {
91         return PATH;
92     }
93
94     /*
95      * (non-Javadoc)
96      *
97      * @see
98      * org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
99      */
100     @Override
101     public String getDescription() {
102         return DESCRIPTION;
103     }
104
105     /*
106      * (non-Javadoc)
107      *
108      * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
109      */
110     @Override
111     public String getReference() {
112         return REFERENCE;
113     }
114
115     /*
116      * (non-Javadoc)
117      *
118      * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
119      */
120     @Override
121     public Status getStatus() {
122         return Status.CURRENT;
123     }
124
125     @Override
126     public List<UnknownSchemaNode> getUnknownSchemaNodes() {
127         return Collections.emptyList();
128     }
129
130     @Override
131     public String toString() {
132         StringBuilder builder = new StringBuilder();
133         builder.append("BooleanType [name=");
134         builder.append(BaseTypes.BOOLEAN_QNAME);
135         builder.append(", path=");
136         builder.append(PATH);
137         builder.append("]");
138         return builder.toString();
139     }
140 }