01: package net.sourceforge.jaxor.mappers;
02:
03: import net.sourceforge.jaxor.MetaField;
04: import net.sourceforge.jaxor.api.FieldLifeCycleListener;
05: import net.sourceforge.jaxor.api.JaxorContext;
06:
07: import java.sql.Timestamp;
08:
09: /**
10: * Created By: Mike
11: * Date: Nov 27, 2003
12: * Time: 9:15:07 PM
13: *
14: * Last Checkin: $Author: mrettig $
15: * Date: $Date: 2004/01/24 18:04:00 $
16: * Revision: $Revision: 1.5 $
17: */
18: public class TimestampUpdateFieldAdapter extends FieldAdapterImpl
19: implements FieldLifeCycleListener {
20:
21: public TimestampUpdateFieldAdapter(MetaField metaData, Object obj) {
22: super (metaData, obj);
23: }
24:
25: public void beforeInsert(JaxorContext context) {
26: }
27:
28: private void increment() {
29: setValue(new Timestamp(System.currentTimeMillis()));
30: }
31:
32: public void beforeUpdate(JaxorContext context) {
33: increment();
34: }
35:
36: public void beforeDelete(JaxorContext context) {
37: }
38: }
|