private void load() throws IOException { try { ObjectMapper.forObject(this).populate(this.node); } catch (ObjectMappingException e) { throw new IOException(e); } this.loader.save(node); }
@Override public void save() throws IOException { try { ObjectMapper.forObject(this).serialize(this.node); } catch (ObjectMappingException e) { throw new IOException(e); } this.loader.save(node); }
@Test public void testNestedObjectWithComments() throws ObjectMappingException { CommentedConfigurationNode node = SimpleCommentedConfigurationNode.root(); final ObjectMapper<ParentObject>.BoundInstance mapper = ObjectMapper.forObject(new ParentObject()); mapper.populate(node); assertEquals("Comment on parent", node.getNode("inner").getComment().get()); assertTrue(node.getNode("inner").hasMapChildren()); assertEquals("Default value", node.getNode("inner", "test").getString()); assertEquals("Something", node.getNode("inner", "test").getComment().get()); }