OverridesMap extends SubstitutionNode<V> implements SubstitutionProvider<V> { @Override protected void registerSubstitute(String[] elements, int index, V value) { super.registerSubstitute(elements, index, value); for(int i=0;i<index;i++) { registerParent(i>0?elements[i-1]:null,elements[i]); } }  @Override boolean hasSubstitutionsFor(AlignmentContext context, String childName); @Override V getOverride(AlignmentContext context); @Override V getDefault(AlignmentContext context);  }
@Test public void test() { map.registerSubstitute("Party/Id", "PartyId"); map.registerSubstitute("Address/Id", "AdressId"); map.registerSubstitute("Id", "DefaultId"); map.registerSubstitute("Data", "Data"); map.registerSubstitute("Root/Sub", "SubValue"); testSubst(null,"Id","DefaultId"); testSubst(null,"Party",null, true); testSubst(null,"Data","Data"); testSubst(null,"Sub",null); testSubst("Root","Id","DefaultId"); testSubst("Root","Party",null, true); testSubst("Root","Data","Data"); testSubst("Root","Sub","SubValue"); testSubst("Root/Party","Id","PartyId"); testSubst("Root/Party","Party",null, true); testSubst("Root/Party","Data","Data"); }