1 19 package org.apache.cayenne.enhancer; 20 21 import org.apache.cayenne.ObjectContext; 22 import org.apache.cayenne.ObjectId; 23 import org.apache.cayenne.Persistent; 24 import org.objectweb.asm.ClassAdapter; 25 import org.objectweb.asm.ClassVisitor; 26 27 34 public class PersistentInterfaceVisitor extends ClassAdapter { 35 36 protected EnhancementHelper helper; 37 38 public PersistentInterfaceVisitor(ClassVisitor visitor) { 39 super(visitor); 40 this.helper = new EnhancementHelper(this); 41 } 42 43 46 @Override 47 public void visit( 48 int version, 49 int access, 50 String name, 51 String signature, 52 String superName, 53 String [] interfaces) { 54 55 helper.reset(name); 56 interfaces = helper.addInterface(interfaces, Persistent.class); 57 58 super.visit(version, access, name, signature, superName, interfaces); 59 60 helper.createProperty(ObjectId.class, "objectId"); 61 helper.createProperty(ObjectContext.class, "objectContext", true); 62 helper.createProperty(Integer.TYPE, "persistenceState"); 63 } 64 } 65 | Popular Tags |