1 18 package org.objectweb.speedo.generation.mivisitor; 19 20 import org.objectweb.speedo.metadata.SpeedoExtension; 21 import org.objectweb.speedo.metadata.SpeedoField; 22 import org.objectweb.speedo.metadata.SpeedoTuple; 23 import org.objectweb.speedo.api.SpeedoException; 24 import org.objectweb.util.monolog.api.BasicLevel; 25 26 31 public class TupleExtensionCopier extends AbstractMetaInfoVisitor { 32 33 public TupleExtensionCopier() { 34 } 35 36 public TupleExtensionCopier(MetaInfoVisitor mim) { 37 super(mim); 38 } 39 40 protected String getLoggerName() { 41 return LOGGER_NAME + ".tupleExtensionCopier"; 42 } 43 44 public void visitExtension(SpeedoExtension se) throws SpeedoException { 45 debug = logger.isLoggable(BasicLevel.DEBUG); 46 if (se.jdoElement instanceof SpeedoTuple) { 47 SpeedoField sf = ((SpeedoTuple) se.jdoElement).jdoField; 48 SpeedoExtension oldse = sf.getExtensionByKey(se.key); 49 if (oldse != null) { 50 if ((se.value == null && oldse.value!= null) 52 || se.value != null && !se.value.equals(oldse.value)) { 53 throw new SpeedoException( 55 "Duplicate extension declaration without the same value: extension name='" 56 + se.key + "', field name='" + sf.name 57 + "' in the class '" + sf.jdoClass.getFQName() 58 + "' in the jdo file " + sf.jdoClass.getJDOFileName() 59 + "'"); 60 } 61 } else { se.jdoElement.addExtension(se); 63 } 64 } 65 super.visitExtension(se); 66 } 67 } 68 | Popular Tags |