@Test public void testDeserialize_container() throws SerializationException { NormalizedNode<?, ?> deserializeContainer = bindingSerializer.deserialize(this.schemaContext, new StringReader(loadResourceAsString("top-level-container.json"))); Assert.assertNotNull(deserializeContainer); LOG.info(deserializeContainer.toString()); }
@Override public NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData) throws SerializationException { NormalizedNodeResult result = new NormalizedNodeResult(); JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.createLazy(schemaContext); try (JsonReader reader = new JsonReader(inputData); NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); JsonParserStream jsonParser = JsonParserStream.create(streamWriter, jsonCodecFactory, schemaNode)) { jsonParser.parse(reader); } catch (IOException e) { throw new SerializationException(e); } return result.getResult(); }
JsonNodeConverter implements NodeConverter { @Override public NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData) throws SerializationException { NormalizedNodeResult result = new NormalizedNodeResult(); JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.createLazy(schemaContext); try (JsonReader reader = new JsonReader(inputData); NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); JsonParserStream jsonParser = JsonParserStream.create(streamWriter, jsonCodecFactory, schemaNode)) { jsonParser.parse(reader); } catch (IOException e) { throw new SerializationException(e); } return result.getResult(); } }
JsonNodeConverter implements NodeConverter { @Override public NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData) throws SerializationException { NormalizedNodeResult result = new NormalizedNodeResult(); JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.createLazy(schemaContext); try (JsonReader reader = new JsonReader(inputData); NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); JsonParserStream jsonParser = JsonParserStream.create(streamWriter, jsonCodecFactory, schemaNode)) { jsonParser.parse(reader); } catch (IOException e) { throw new SerializationException(e); } return result.getResult(); } JsonNodeConverter(final SchemaContext schemaContext); }
JsonNodeConverter implements NodeConverter { @Override public NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData) throws SerializationException { NormalizedNodeResult result = new NormalizedNodeResult(); JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.createLazy(schemaContext); try (JsonReader reader = new JsonReader(inputData); NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); JsonParserStream jsonParser = JsonParserStream.create(streamWriter, jsonCodecFactory, schemaNode)) { jsonParser.parse(reader); } catch (IOException e) { throw new SerializationException(e); } return result.getResult(); } JsonNodeConverter(final SchemaContext schemaContext); @Override Writer serializeData(final SchemaNode schemaNode, final NormalizedNode<?, ?> normalizedNode); @Override Writer serializeRpc(final SchemaNode schemaNode, final NormalizedNode<?, ?> normalizedNode); @Override NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData); }
JsonNodeConverter implements NodeConverter { @Override public NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData) throws SerializationException { NormalizedNodeResult result = new NormalizedNodeResult(); JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.createLazy(schemaContext); try (JsonReader reader = new JsonReader(inputData); NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); JsonParserStream jsonParser = JsonParserStream.create(streamWriter, jsonCodecFactory, schemaNode)) { jsonParser.parse(reader); } catch (IOException e) { throw new SerializationException(e); } return result.getResult(); } JsonNodeConverter(final SchemaContext schemaContext); @Override Writer serializeData(final SchemaNode schemaNode, final NormalizedNode<?, ?> normalizedNode); @Override Writer serializeRpc(final SchemaNode schemaNode, final NormalizedNode<?, ?> normalizedNode); @Override NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData);  }