@Beta public final class JSONCodecFactory extends AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
SchemaContext
, but can be reused by multiple JSONNormalizedNodeStreamWriter
s.
There are multiple implementations available, each with distinct thread-safety, CPU/memory trade-offs and reuse
characteristics. See getShared(SchemaContext)
, getPrecomputed(SchemaContext)
,
createLazy(SchemaContext)
and createSimple(SchemaContext)
for details.Modifier and Type | Method and Description |
---|---|
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
binaryCodec(BinaryTypeDefinition type) |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
bitsCodec(BitsTypeDefinition type) |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
booleanCodec(BooleanTypeDefinition type) |
static JSONCodecFactory |
create(SchemaContext context)
Deprecated.
Use
getShared(SchemaContext) instead. |
static JSONCodecFactory |
createLazy(SchemaContext context)
Deprecated.
Use
JSONCodecFactorySupplier.createLazy(SchemaContext) instead. |
static JSONCodecFactory |
createSimple(SchemaContext context)
Deprecated.
Use
JSONCodecFactorySupplier.createSimple(SchemaContext) instead. |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
decimalCodec(DecimalTypeDefinition type) |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
emptyCodec(EmptyTypeDefinition type) |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
enumCodec(EnumTypeDefinition type) |
static JSONCodecFactory |
getPrecomputed(SchemaContext context)
Deprecated.
|
static com.google.common.base.Optional<JSONCodecFactory> |
getPrecomputedIfAvailable(SchemaContext context)
Deprecated.
|
static JSONCodecFactory |
getShared(SchemaContext context)
Deprecated.
Use
JSONCodecFactorySupplier.getShared(SchemaContext) instead. |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
identityRefCodec(IdentityrefTypeDefinition type,
QNameModule module) |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
instanceIdentifierCodec(InstanceIdentifierTypeDefinition type) |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
intCodec(IntegerTypeDefinition type) |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
stringCodec(StringTypeDefinition type) |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
uintCodec(UnsignedIntegerTypeDefinition type) |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
unionCodec(UnionTypeDefinition type,
List<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>> codecs) |
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> |
unknownCodec(UnknownTypeDefinition type) |
codecFor, getSchemaContext
@Deprecated public static JSONCodecFactory create(SchemaContext context)
getShared(SchemaContext)
instead.context
- SchemaContext to which the factory should be bound@Deprecated public static JSONCodecFactory getPrecomputed(SchemaContext context)
JSONCodecFactorySupplier.getPrecomputed(SchemaContext)
instead.JSONCodecFactory
for a SchemaContext. This method can, and will,
return the same instance as long as the associated SchemaContext is present. Returned object can be safely
used by multiple threads concurrently. If the SchemaContext instance does not have a cached instance
of JSONCodecFactory
, it will be completely precomputed before this method will return.
Choosing this implementation is appropriate when the memory overhead of keeping a full codec tree is not as
great a concern as predictable performance. When compared to the implementation returned by
getShared(SchemaContext)
, this implementation is expected to offer higher performance and have lower
peak memory footprint when most of the SchemaContext is actually in use.
For call sites which do not want to pay the CPU cost of pre-computing this implementation, but still would like
to use it if is available (by being populated by some other caller), you can use
getPrecomputedIfAvailable(SchemaContext)
.context
- SchemaContext instanceJSONCodecFactory
NullPointerException
- if context is null@Deprecated public static com.google.common.base.Optional<JSONCodecFactory> getPrecomputedIfAvailable(SchemaContext context)
JSONCodecFactorySupplier.getPrecomputedIfAvailable(SchemaContext)
instead.JSONCodecFactory
for a SchemaContext, if it is available. This
method is a non-blocking equivalent of getPrecomputed(SchemaContext)
for use in code paths where
the potential of having to pre-compute the implementation is not acceptable. One such scenario is when the
code base wants to opportunistically take advantage of pre-computed version, but is okay with a fallback to
a different implementation.context
- SchemaContext instanceJSONCodecFactory
, or absent if such an implementation is not available.NullPointerException
- if context is null@Deprecated public static JSONCodecFactory getShared(SchemaContext context)
JSONCodecFactorySupplier.getShared(SchemaContext)
instead.JSONCodecFactory
for a SchemaContext. This method can, and will,
return the same instance as long as the associated SchemaContext is present or the factory is not invalidated
by memory pressure. Returned object can be safely used by multiple threads concurrently.
Choosing this implementation is a safe default, as it will not incur prohibitive blocking, nor will it tie up
memory in face of pressure.context
- SchemaContext instanceJSONCodecFactory
NullPointerException
- if context is null@Deprecated public static JSONCodecFactory createLazy(SchemaContext context)
JSONCodecFactorySupplier.createLazy(SchemaContext)
instead.JSONCodecFactory
for a SchemaContext. This method will
return distinct objects every time it is invoked. Returned object may not be used from multiple threads
concurrently.
This implementation is appropriate for one-off serialization from a single thread. It will aggressively cache
codecs for reuse and will tie them up in memory until the factory is freed.context
- SchemaContext instanceJSONCodecFactory
NullPointerException
- if context is null@Deprecated public static JSONCodecFactory createSimple(SchemaContext context)
JSONCodecFactorySupplier.createSimple(SchemaContext)
instead.JSONCodecFactory
for a SchemaContext
. This method will return
distinct objects every time it is invoked. Returned object may be use from multiple threads concurrently.
This implementation exists mostly for completeness only, as it does not perform any caching at all and each codec
is computed every time it is requested. This may be useful in extremely constrained environments, where memory
footprint is more critical than performance.context
- SchemaContext instanceJSONCodecFactory
NullPointerException
- if context is null.protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> binaryCodec(BinaryTypeDefinition type)
binaryCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> booleanCodec(BooleanTypeDefinition type)
booleanCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> bitsCodec(BitsTypeDefinition type)
bitsCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> decimalCodec(DecimalTypeDefinition type)
decimalCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> emptyCodec(EmptyTypeDefinition type)
emptyCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> enumCodec(EnumTypeDefinition type)
enumCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> identityRefCodec(IdentityrefTypeDefinition type, QNameModule module)
identityRefCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> instanceIdentifierCodec(InstanceIdentifierTypeDefinition type)
instanceIdentifierCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> intCodec(IntegerTypeDefinition type)
intCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> stringCodec(StringTypeDefinition type)
stringCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> uintCodec(UnsignedIntegerTypeDefinition type)
uintCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> unionCodec(UnionTypeDefinition type, List<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>> codecs)
unionCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
protected org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?> unknownCodec(UnknownTypeDefinition type)
unknownCodec
in class AbstractCodecFactory<org.opendaylight.yangtools.yang.data.codec.gson.JSONCodec<?>>
Copyright © 2018 OpenDaylight. All rights reserved.