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 RFC7951JSONCodecFactory extends JSONCodecFactory {
17 private final RFC7951JSONInstanceIdentifierCodec iidCodec;
19 RFC7951JSONCodecFactory(final EffectiveModelContext context, final CodecCache<JSONCodec<?>> cache) {
20 super(context, cache);
21 iidCodec = new RFC7951JSONInstanceIdentifierCodec(context, this);
25 protected JSONCodec<?> instanceIdentifierCodec(final InstanceIdentifierTypeDefinition type) {
30 JSONCodecFactory rebaseTo(final EffectiveModelContext newSchemaContext, final CodecCache<JSONCodec<?>> newCache) {
31 return new RFC7951JSONCodecFactory(newSchemaContext, newCache);
35 JSONCodec<?> wrapDecimalCodec(final DecimalStringCodec decimalCodec) {
36 return new QuotedJSONCodec<>(decimalCodec);
40 JSONCodec<?> wrapIntegerCodec(final AbstractIntegerStringCodec<?, ?> integerCodec) {
41 return new QuotedJSONCodec<>(integerCodec);