@Test public void testGetDelegate() { MustacheEngine engine = MustacheEngineBuilder.newBuilder() .addContextConverter(decorate(Hammer.class).compute("name", h -> h.getName().toUpperCase()).build()) .build(); Hammer hammer = new Hammer(); assertEquals("EDGAR vs Edgar", engine.compileMustache("{{name}} vs {{delegate.name}}").render(hammer)); }
public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); }
DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } }
DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } private  DecoratorConverter(Predicate<Object> test, String delegateKey, Map<String, Function<T, Object>> mappings); }
DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } private  DecoratorConverter(Predicate<Object> test, String delegateKey, Map<String, Function<T, Object>> mappings); static Builder<T> decorate(Class<T> delegateType); static Builder<T> decorate(Predicate<Object> test); @SuppressWarnings("unchecked") @Override Object convert(Object from); }
DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } private  DecoratorConverter(Predicate<Object> test, String delegateKey, Map<String, Function<T, Object>> mappings); static Builder<T> decorate(Class<T> delegateType); static Builder<T> decorate(Predicate<Object> test); @SuppressWarnings("unchecked") @Override Object convert(Object from);  }