@Override public void loadInternal(CommentedConfigurationNode node, BufferedReader reader) throws IOException { Config hoconConfig = ConfigFactory.parseReader(reader, parse); hoconConfig = hoconConfig.resolve(); for (Map.Entry<String, ConfigValue> ent : hoconConfig.root().entrySet()) { readConfigValue(ent.getValue(), node.getNode(ent.getKey())); } }
@Override public void loadInternal(CommentedConfigurationNode node, BufferedReader reader) throws IOException { Config hoconConfig = ConfigFactory.parseReader(reader, parse); hoconConfig = hoconConfig.resolve(); for (Map.Entry<String, ConfigValue> ent : hoconConfig.root().entrySet()) { readConfigValue(ent.getValue(), node.getNode(ent.getKey())); } }
private void readConfigValue(ConfigValue value, CommentedConfigurationNode node) { if (!value.origin().comments().isEmpty()) { node.setComment(CRLF_MATCH.matcher(Joiner.on('\n').join(value.origin().comments())).replaceAll("")); } switch (value.valueType()) { case OBJECT: if (((ConfigObject) value).isEmpty()) { node.setValue(ImmutableMap.of()); } else { for (Map.Entry<String, ConfigValue> ent : ((ConfigObject) value).entrySet()) { readConfigValue(ent.getValue(), node.getNode(ent.getKey())); } } break; case LIST: List<ConfigValue> values = (ConfigList) value; for (int i = 0; i < values.size(); ++i) { readConfigValue(values.get(i), node.getNode(i)); } break; case NULL: return; default: node.setValue(value.unwrapped()); } }
private static void readConfigValue(ConfigValue value, CommentedConfigurationNode node) { if (!value.origin().comments().isEmpty()) { node.setComment(CRLF_MATCH.matcher(Joiner.on('\n').join(value.origin().comments())).replaceAll("")); } switch (value.valueType()) { case OBJECT: if (((ConfigObject) value).isEmpty()) { node.setValue(ImmutableMap.of()); } else { for (Map.Entry<String, ConfigValue> ent : ((ConfigObject) value).entrySet()) { readConfigValue(ent.getValue(), node.getNode(ent.getKey())); } } break; case LIST: List<ConfigValue> values = (ConfigList) value; for (int i = 0; i < values.size(); ++i) { readConfigValue(values.get(i), node.getNode(i)); } break; case NULL: return; default: node.setValue(value.unwrapped()); } }