@Test public void testTransformTree() { Map<String, Object> serviceSite = new HashMap<String, Object>(); serviceSite.put("property", "service-site-property"); Map<String, Object> configurations = new HashMap<String, Object>(); configurations.put("service-site", serviceSite); configurations.put("property", "configuration-property"); Map<String, Object> context = new HashMap<String, Object>(); context.put("configurations", configurations); context.put("property", "context-property"); ContextTransformer transformer; transformer = new ContextTransformer("configurations/service-site/property"); Assert.assertEquals("service-site-property", transformer.transform(context)); transformer = new ContextTransformer("/configurations/service-site/property"); Assert.assertEquals("service-site-property", transformer.transform(context)); transformer = new ContextTransformer("/configurations/service-site"); Assert.assertEquals(serviceSite, transformer.transform(context)); }
@Override public Object transform(Object o) { return transform(key, o); }
ContextTransformer implements Transformer { @Override public Object transform(Object o) { return transform(key, o); } }
ContextTransformer implements Transformer { @Override public Object transform(Object o) { return transform(key, o); } ContextTransformer(String key); }
ContextTransformer implements Transformer { @Override public Object transform(Object o) { return transform(key, o); } ContextTransformer(String key); String getKey(); @Override Object transform(Object o); @Override int hashCode(); @Override boolean equals(Object obj); }
ContextTransformer implements Transformer { @Override public Object transform(Object o) { return transform(key, o); } ContextTransformer(String key); String getKey(); @Override Object transform(Object o); @Override int hashCode(); @Override boolean equals(Object obj);  }