No, you cannot add synchronizedto such fields.
- You can create it every time you call
doSomething:
:.
public void doSomething() {
Map<String,String> beans = new HashMap<String,String>();
beans.put("df", new SimpleDateFormat("dd.MM.yyyy"));
XLSTransformer transformer = new XLSTransformer();
transformer.transformXLS("template.xls", beans, "result.xls");
}
SimpleDateFormat, (, SimpleDateFormat , xslt).
ThreadLocal :
:.
private static final ThreadLocal<SimpleDateFormat> df =
new ThreadLocal<Integer>() {
@Override protected Integer initialValue() {
return new SimpleDateFormat("dd.MM.yyyy");
}
};
public void doSomething() {
beans.put("df", df.get());
}
- - , jodatime
DateTimeFormat. DateTimeFormat .