私は Smooks が初めてで、次のことを達成したいと考えています。私はこれにまったく慣れておらず、まだ答えがわからないかもしれませんが、これは基本的なことです。
beanpopulator の公式ドキュメントに示されている例から抜粋しています。
http://www.milyn.org/javadoc/v1.0/smooks-cartridges/javabean/org/milyn/javabean/BeanPopulator.html
public class Header {
private Date date;
private Long customerNumber;
private String customerName;
}
対応する smooks 構成
<-- Create the Header bean instance when we encounter the "header" element.
Call it "header" -->
<resource-config selector="header">
<resource>org.milyn.javabean.BeanPopulator</resource>
<param name="beanId">header</param>
<param name="beanClass">org.milyn.javabean.Header</param>
<param name="bindings">
<-- Header bindings... -->
<binding property="date" type="OrderDateLong" selector="header/date" /> <-- See OrderDateLong decoder definition below... -->
<binding property="customerNumber" type="Long" selector="header/customer/@number" />
<binding property="customerName" selector="header/customer" /> <-- Type defaults to String -->
</param>
</resource-config>
Suppose that the field 'customerName' doesn't need to be retrieved from 'selecter', instead it should be populated with a unique value every time. (Ex: customerName = 'Richard')
How do I achieve this? Thanks!
EDIT: In case if this looks silly. What I want to do is add a value to a map sort of a thing. I read a CSV for this and if the CSV contains a certain header (ex: customerName) I add it to the map with the key as 'customerName'. Reading the header from the CSV is another thing in my mind, but I couldn't find a solution for that as well.