@Test public void testMerge() { ObjectNode objectNode = new ObjectNodeBuilderImpl() .addList("top1.prop1", new ListNodeBuilderImpl() .addValue("text value") .addList(ListNode.builder().addValue("another value").build()) .addObject(ObjectNode.builder().addValue("obj1.key1", "value1").build()) .build()) .addValue("top1.prop1.0", "new text value") .addValue("top1.prop1.1.0", "another another value") .addValue("top1.prop1.2.obj1.key1", "value2") .build(); ListNode listNode = (ListNode) ((ObjectNode) objectNode.get("top1")).get("prop1"); assertThat(listNode, hasSize(3)); assertThat(listNode.get(0), instanceOf(ValueNode.class)); assertThat(listNode.get(0), valueNode("new text value")); assertThat(listNode.get(1), instanceOf(ListNode.class)); assertThat(((ListNode) listNode.get(1)).get(0), valueNode("another another value")); assertThat(listNode.get(2), instanceOf(ObjectNode.class)); assertThat(((ObjectNode) ((ObjectNode) listNode.get(2)).get("obj1")).get("key1"), valueNode("value2")); }
@Override protected void merge(Integer index, MergeableNode node) { try { elements.set(index, elements.get(index).merge(node)); } catch (ConfigException ex) { throw new ConfigException(index + ": " + ex.getLocalizedMessage(), ex); } }
ListNodeBuilderImpl extends AbstractNodeBuilderImpl<Integer, ListNode.Builder> implements ListNode.Builder { @Override protected void merge(Integer index, MergeableNode node) { try { elements.set(index, elements.get(index).merge(node)); } catch (ConfigException ex) { throw new ConfigException(index + ": " + ex.getLocalizedMessage(), ex); } } }
ListNodeBuilderImpl extends AbstractNodeBuilderImpl<Integer, ListNode.Builder> implements ListNode.Builder { @Override protected void merge(Integer index, MergeableNode node) { try { elements.set(index, elements.get(index).merge(node)); } catch (ConfigException ex) { throw new ConfigException(index + ": " + ex.getLocalizedMessage(), ex); } } ListNodeBuilderImpl();  ListNodeBuilderImpl(Function<String, String> resolveTokenFunctions); }
ListNodeBuilderImpl extends AbstractNodeBuilderImpl<Integer, ListNode.Builder> implements ListNode.Builder { @Override protected void merge(Integer index, MergeableNode node) { try { elements.set(index, elements.get(index).merge(node)); } catch (ConfigException ex) { throw new ConfigException(index + ": " + ex.getLocalizedMessage(), ex); } } ListNodeBuilderImpl();  ListNodeBuilderImpl(Function<String, String> resolveTokenFunctions); ListNodeBuilderImpl addNode(ConfigNode node); @Override ListNodeBuilderImpl value(String value); @Override ListNode.Builder addValue(ValueNode value); @Override ListNode.Builder addObject(ObjectNode object); @Override ListNode.Builder addList(ListNode list); @Override ListNodeImpl build(); @Override String toString(); }
ListNodeBuilderImpl extends AbstractNodeBuilderImpl<Integer, ListNode.Builder> implements ListNode.Builder { @Override protected void merge(Integer index, MergeableNode node) { try { elements.set(index, elements.get(index).merge(node)); } catch (ConfigException ex) { throw new ConfigException(index + ": " + ex.getLocalizedMessage(), ex); } } ListNodeBuilderImpl();  ListNodeBuilderImpl(Function<String, String> resolveTokenFunctions); ListNodeBuilderImpl addNode(ConfigNode node); @Override ListNodeBuilderImpl value(String value); @Override ListNode.Builder addValue(ValueNode value); @Override ListNode.Builder addObject(ObjectNode object); @Override ListNode.Builder addList(ListNode list); @Override ListNodeImpl build(); @Override String toString();  }