@Test public void canAddComplexTaxonomy() { Collection<Object> taxonomy = new ArrayList<>(); taxonomy.add( ImmutableMap.of( "Entity", ImmutableList.of("Person", ImmutableMap.of("Location", ImmutableList.of("Point"))))); taxonomy.add(ImmutableMap.of("Other", ImmutableList.of("Tree"))); taxonomy.add("Event"); OdinConfigurationProcessor ruleProcessor = new OdinConfigurationProcessor(taxonomy, "rules:"); String processedRules = ruleProcessor.process(); assertTrue( processedRules, processedRules.contains( "taxonomy:\n- Entity:\n - Person\n - Location:\n - Point\n- Other:\n - Tree\n- Event")); }
public String process() { Object loaded = yaml.load(configuration); Map<String, Object> map; if (loaded instanceof Map<?, ?>) { map = (Map<String, Object>) loaded; } else { map = new LinkedHashMap<>(); } addTaxonomy(map); addEntityRules(map); return yaml.dump(map); }
OdinConfigurationProcessor { public String process() { Object loaded = yaml.load(configuration); Map<String, Object> map; if (loaded instanceof Map<?, ?>) { map = (Map<String, Object>) loaded; } else { map = new LinkedHashMap<>(); } addTaxonomy(map); addEntityRules(map); return yaml.dump(map); } }
OdinConfigurationProcessor { public String process() { Object loaded = yaml.load(configuration); Map<String, Object> map; if (loaded instanceof Map<?, ?>) { map = (Map<String, Object>) loaded; } else { map = new LinkedHashMap<>(); } addTaxonomy(map); addEntityRules(map); return yaml.dump(map); } OdinConfigurationProcessor(Collection<Object> taxonomy, String configuration); }
OdinConfigurationProcessor { public String process() { Object loaded = yaml.load(configuration); Map<String, Object> map; if (loaded instanceof Map<?, ?>) { map = (Map<String, Object>) loaded; } else { map = new LinkedHashMap<>(); } addTaxonomy(map); addEntityRules(map); return yaml.dump(map); } OdinConfigurationProcessor(Collection<Object> taxonomy, String configuration); String process(); }
OdinConfigurationProcessor { public String process() { Object loaded = yaml.load(configuration); Map<String, Object> map; if (loaded instanceof Map<?, ?>) { map = (Map<String, Object>) loaded; } else { map = new LinkedHashMap<>(); } addTaxonomy(map); addEntityRules(map); return yaml.dump(map); } OdinConfigurationProcessor(Collection<Object> taxonomy, String configuration); String process();  }