2 * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.data.codec.gson;
10 import org.opendaylight.yangtools.yang.data.impl.codec.AbstractIntegerStringCodec;
11 import org.opendaylight.yangtools.yang.data.impl.codec.DecimalStringCodec;
12 import org.opendaylight.yangtools.yang.data.util.codec.CodecCache;
13 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
14 import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition;
16 final class Lhotka02JSONCodecFactory extends JSONCodecFactory {
17 private final JSONInstanceIdentifierCodec iidCodec;
19 Lhotka02JSONCodecFactory(final EffectiveModelContext context, final CodecCache<JSONCodec<?>> cache) {
20 super(context, cache);
21 iidCodec = new Lhotka02JSONInstanceIdentifierCodec(context, this);
25 protected JSONCodec<?> instanceIdentifierCodec(final InstanceIdentifierTypeDefinition type) {
30 Lhotka02JSONCodecFactory rebaseTo(final EffectiveModelContext newSchemaContext,
31 final CodecCache<JSONCodec<?>> newCache) {
32 return new Lhotka02JSONCodecFactory(newSchemaContext, newCache);
36 JSONCodec<?> wrapDecimalCodec(final DecimalStringCodec decimalCodec) {
37 return new NumberJSONCodec<>(decimalCodec);
41 JSONCodec<?> wrapIntegerCodec(final AbstractIntegerStringCodec<?, ?> integerCodec) {
42 return new NumberJSONCodec<>(integerCodec);