use of org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory in project netconf by opendaylight.
the class NormalizedNodeJsonBodyWriter method createNormalizedNodeWriter.
private static RestconfNormalizedNodeWriter createNormalizedNodeWriter(final InstanceIdentifierContext<SchemaNode> context, final SchemaPath path, final JsonWriter jsonWriter, @Nullable final Integer depth) {
final SchemaNode schema = context.getSchemaNode();
final JSONCodecFactory codecs = getCodecFactory(context);
final XMLNamespace initialNs;
if (schema instanceof DataSchemaNode && !((DataSchemaNode) schema).isAugmenting() && !(schema instanceof SchemaContext) || schema instanceof RpcDefinition) {
initialNs = schema.getQName().getNamespace();
} else {
initialNs = null;
}
final NormalizedNodeStreamWriter streamWriter = JSONNormalizedNodeStreamWriter.createNestedWriter(codecs, path, initialNs, jsonWriter);
if (depth != null) {
return DepthAwareNormalizedNodeWriter.forStreamWriter(streamWriter, depth);
}
return RestconfDelegatingNormalizedNodeWriter.forStreamWriter(streamWriter);
}
use of org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory in project netconf by opendaylight.
the class JsonNormalizedNodeBodyWriter method createNormalizedNodeWriter.
private static RestconfNormalizedNodeWriter createNormalizedNodeWriter(final InstanceIdentifierContext<SchemaNode> context, final SchemaPath path, final JsonWriter jsonWriter, final DepthParam depth, final List<Set<QName>> fields) {
final SchemaNode schema = context.getSchemaNode();
final JSONCodecFactory codecs = getCodecFactory(context);
final NormalizedNodeStreamWriter streamWriter = JSONNormalizedNodeStreamWriter.createNestedWriter(codecs, path, initialNamespaceFor(schema), jsonWriter);
return ParameterAwareNormalizedNodeWriter.forStreamWriter(streamWriter, depth, fields);
}
Aggregations