资 源 简 介
A simple Java framework to copy beans
This Java framework is a lite solution to translate beans of your multi-tiers architecture.
You develop atomic and reusable translators and map them to attributes thanks to annotations.
```
DateValue value = new DateValue();
value.setDate(new Date());
DateModel model = Kopipi.translate(value, new DateModel());
```
```
public class DateValue {
@Translate(translator = DateTranslator.class)
private Date date;
}
public class DateModel {
@Translate(translator = DateTranslator.class)
private String date;
}
public class DateTranslator {
private static final String DATE_FORMAT = "dd/MM/yyyy";
public String translate(Date date) {
return new SimpleDateFormat(DATE_FORMAT).format(date);
}
public Date translate(String date) throws ParseException {
return new SimpleDateFormat(DATE_FORMAT).parse(date);
}
}
```