1 23 24 package org.objectweb.jorm.mapper.fos.metainfo; 25 26 import org.objectweb.jorm.metainfo.lib.BasicMapping; 27 import org.objectweb.jorm.metainfo.api.MetaObject; 28 import org.objectweb.jorm.metainfo.api.GenClassRef; 29 import org.objectweb.jorm.metainfo.api.ClassMapping; 30 import org.objectweb.util.monolog.api.BasicLevel; 31 32 35 public class FosMapping extends BasicMapping { 36 43 public FosMapping(String mapperName, MetaObject parent) { 44 super(mapperName, parent); 45 } 46 47 54 public ClassMapping createClassMapping(String ruleName) { 55 FosClassMapping res = (FosClassMapping) getClassMapping(); 56 if (res == null) { 57 res = new FosClassMapping(getParent().getParent(), this); 58 setClassMapping(res); 59 res.setLogger(logger); 60 } else { 61 res.setRuleName(ruleName); 62 } 63 return res; 64 } 65 66 74 public FosGenClassMapping createGenClassMapping(String ruleName, 75 MetaObject linkedMO) { 76 String gcid = ((GenClassRef) linkedMO).getGenClassId(); 77 if (logger.isLoggable(BasicLevel.DEBUG)) { 78 logger.log(BasicLevel.DEBUG, "(gcid " + gcid + ")"); 79 } 80 FosGenClassMapping res = (FosGenClassMapping) getGenClassMapping(gcid); 81 if (res == null) { 82 res = new FosGenClassMapping(linkedMO, this); 83 res.setLogger(logger); 84 addGenClassMapping(gcid, res); 85 } else { 86 res.setRuleName(ruleName); 87 res.setLinkedMO(linkedMO); 88 } 89 return res; 90 } 91 } 92 | Popular Tags |