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