1 18 package org.objectweb.speedo.generation.enhancer; 19 20 import org.objectweb.asm.Attribute; 21 import org.objectweb.asm.ClassVisitor; 22 import org.objectweb.asm.Constants; 23 import org.objectweb.speedo.metadata.SpeedoClass; 24 import org.objectweb.util.monolog.api.Logger; 25 26 31 public class PersistentFieldRemover extends LoggedClassAdapter { 32 33 SpeedoClass clazz; 34 35 public PersistentFieldRemover(final ClassVisitor classVisitor, 36 final SpeedoClass jdoClass) { 37 super(classVisitor); 38 this.clazz = jdoClass; 39 } 40 41 public PersistentFieldRemover(final ClassVisitor classVisitor, 42 final SpeedoClass jdoClass, 43 final Logger logger) { 44 super(classVisitor, logger); 45 this.clazz = jdoClass; 46 } 47 48 public void visitField(final int access, 49 final String name, 50 final String desc, 51 final Object value, 52 final Attribute attrs) { 53 if (((access & Constants.ACC_STATIC) != 0) 54 || clazz.jdoField.get(name)==null) { 55 super.visitField(access, name, desc, value, attrs); 56 } 57 } 58 } 59 | Popular Tags |