Deprecate simple DataTreeFactory.create()
[yangtools.git] / codec / yang-data-codec-gson / src / main / java / org / opendaylight / yangtools / yang / data / codec / gson / NullJSONCodec.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. 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.data.codec.gson;
9
10 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory;
12
13 @Deprecated(since = "13.0.3", forRemoval = true)
14 final class NullJSONCodec implements JSONCodec<Object> {
15     static final NullJSONCodec INSTANCE = new NullJSONCodec();
16     private static final Logger LOG = LoggerFactory.getLogger(NullJSONCodec.class);
17
18     private NullJSONCodec() {
19
20     }
21
22     @Override
23     public Class<Object> getDataType() {
24         return Object.class;
25     }
26
27     @Override
28     public Object parseValue(final String str) {
29         LOG.warn("Call of the deserializeString method on null codec. No operation performed.");
30         return null;
31     }
32
33     @Override
34     public void writeValue(final JSONValueWriter ctx, final Object value) {
35         // NOOP since codec is unknown.
36         LOG.warn("Call of the serializeToWriter method on null codec. No operation performed.");
37     }
38
39     @Override
40     public JSONValue unparseValue(final Object value) {
41         throw new UnsupportedOperationException();
42     }
43 }