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 TimestampInsertFieldAdapter extends FieldAdapterImpl
19: implements FieldLifeCycleListener {
20:
21: public TimestampInsertFieldAdapter(MetaField metaData, Object obj) {
22: super (metaData, obj);
23: }
24:
25: public void beforeInsert(JaxorContext context) {
26: increment();
27: }
28:
29: private void increment() {
30: setValue(new Timestamp(System.currentTimeMillis()));
31: }
32:
33: public void beforeUpdate(JaxorContext context) {
34:
35: }
36:
37: public void beforeDelete(JaxorContext context) {
38: }
39: }
|