Use singleton BaseType instances for simple definitions
[ovsdb.git] / library / impl / src / main / java / org / opendaylight / ovsdb / lib / schema / BooleanBaseType.java
1 /*
2  * Copyright © 2014, 2017 EBay Software Foundation 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.ovsdb.lib.schema;
9
10 import com.fasterxml.jackson.databind.JsonNode;
11
12 final class BooleanBaseType extends BaseType {
13     static final BooleanBaseType SINGLETON = new BooleanBaseType();
14
15     @Override
16     void fillConstraints(final JsonNode node) {
17         //no op
18     }
19
20     @Override
21     public Object toValue(final JsonNode value) {
22         return value.asBoolean();
23     }
24
25     @Override
26     public void validate(final Object value) {
27
28     }
29
30     @Override
31     public String toString() {
32         return "BooleanBaseType";
33     }
34 }