在使用betwixt根据Bean生成xml文件时,Betwixt默认识别的xml模版文件是以bean的名称为主文件名的".betwixt"文件。
比如:
person.class
person.betwixt
如果我希望能够重新指定其他文件作为模版文件的话,该如何操作呢?
比如我希望使用hello.betwixt作为person.class的模板文件,
BeanWriter提供了如下方法:
public void write(Object bean, InputSource source)
这样就成了~:)
比如:
person.class
person.betwixt
如果我希望能够重新指定其他文件作为模版文件的话,该如何操作呢?
比如我希望使用hello.betwixt作为person.class的模板文件,
BeanWriter提供了如下方法:
public void write(Object bean, InputSource source)
InputSource ins = new InputSource(new FileReader("D:\\workspace\\translate_demo\\cfg\\hello.betwixt"));
beanWriter.write(person,ins);
这样就成了~:)