1 18 package org.objectweb.speedo.generation.mivisitor; 19 20 import org.objectweb.asm.Constants; 21 import org.objectweb.speedo.api.SpeedoException; 22 import org.objectweb.speedo.metadata.SpeedoClass; 23 import org.objectweb.speedo.metadata.SpeedoExtension; 24 import org.objectweb.speedo.metadata.SpeedoField; 25 import org.objectweb.speedo.metadata.SpeedoVersion; 26 import org.objectweb.util.monolog.api.BasicLevel; 27 28 32 public class VersionFieldAdder extends AbstractMetaInfoVisitor { 33 34 public void visitClass(SpeedoClass sc) throws SpeedoException { 35 if(sc.version != null){ 36 if(logger != null ){ 37 logger.log(BasicLevel.DEBUG, "VersionFieldAdder.visitClass(" + sc.getFQName() + ")"); 38 logger.log(BasicLevel.DEBUG, "Class " + sc.getFQName() + ": version: " + SpeedoVersion.toString(sc.version.strategy)); 39 } 40 if (sc.version.strategy != SpeedoVersion.NO_VERSION) { 42 SpeedoField sf = new SpeedoField(); 44 sf.access = Constants.ACC_PUBLIC; 45 sf.name = "speedo" + SpeedoVersion.toString(sc.version.strategy); 46 sf.desc = "J"; 48 SpeedoExtension se = new SpeedoExtension("speedo","sql-name", sf.name.toUpperCase(), sf); 50 sf.addExtension(se); 51 sc.add(sf, true, logger); 52 } 53 } 54 super.visitClass(sc); 55 } 56 } | Popular Tags |