1 19 package org.apache.cayenne.jpa.enhancer; 20 21 import java.util.Map ; 22 23 import org.apache.cayenne.enhancer.EnhancerVisitorFactory; 24 import org.apache.cayenne.enhancer.PersistentInterfaceVisitor; 25 import org.apache.cayenne.jpa.map.JpaClassDescriptor; 26 import org.objectweb.asm.ClassVisitor; 27 import org.objectweb.asm.commons.SerialVersionUIDAdder; 28 29 34 public class JpaEnhancerVisitorFactory implements EnhancerVisitorFactory { 35 36 private Map <String , JpaClassDescriptor> managedClasses; 37 38 public JpaEnhancerVisitorFactory(Map <String , JpaClassDescriptor> managedClasses) { 39 this.managedClasses = managedClasses; 40 } 41 42 public ClassVisitor createVisitor(String className, ClassVisitor out) { 43 JpaClassDescriptor descriptor = managedClasses.get(className.replace('/', '.')); 44 if (descriptor == null) { 45 return null; 46 } 47 48 51 PersistentInterfaceVisitor e1 = new PersistentInterfaceVisitor(out); 53 JpaAccessorVisitor e2 = new JpaAccessorVisitor(e1, descriptor); 54 55 SerialVersionUIDAdder e3 = new SerialVersionUIDAdder(e2); 58 59 return e3; 60 } 61 } 62 | Popular Tags |