此内容没有您所选择的语言版本。
5.12. Programmatic Configuration
FreeMarker template configurations can be added to a Smooks instance programmatically. Do so by adding and configuring a
FreeMarkerTemplateProcessor
instance as shown below. This example adds configurations for a Java binding and a FreeMarker template to Smooks:
Smooks smooks = new Smooks(); smooks.addVisitor(new Bean(OrderItem.class, "orderItem", "order-item").bindTo("productId", "order-item/product/@id")); smooks.addVisitor(new FreeMarkerTemplateProcessor(new TemplatingConfiguration("/templates/order-tem.ftl")), "order-item"); // Then use Smooks as normal... filter a Source to a Result etc...