コード例 #1
0
ファイル: Nomin.java プロジェクト: phamthaithinh/nomin
 protected List<MappingWithDirection> findApplicable(MappingKey key) {
   ArrayList<MappingWithDirection> result = new ArrayList<MappingWithDirection>();
   for (ParsedMapping pm : mappings) {
     if ((pm.mappingCase == null && key.mappingCase == null)
         ^ (pm.mappingCase != null && pm.mappingCase.equals(key.mappingCase))) {
       if (pm.sideA.isAssignableFrom(key.source) && pm.sideB.isAssignableFrom(key.target))
         result.add(new MappingWithDirection(pm, true));
       else if (pm.sideB.isAssignableFrom(key.source) && pm.sideA.isAssignableFrom(key.target))
         result.add(new MappingWithDirection(pm, false));
     }
   }
   if (!result.isEmpty()) {
     Collections.sort(result, new MappingComparator(key.target));
   } else if (automappingEnabled) {
     logger.info(
         "Could not find applicable mappings between {} and {}. A mapping will be created using automapping facility",
         key.source.getName(),
         key.target.getName());
     ParsedMapping pm = new Mapping(key.source, key.target, this).automap().parse();
     logger.debug("Automatically created {}", pm);
     mappings.add(pm);
     result.add(new MappingWithDirection(pm, true));
   } else
     logger.warn(
         "Could not find applicable mappings between {} and {}!",
         key.source.getName(),
         key.target.getName());
   return result;
 }
コード例 #2
0
ファイル: Nomin.java プロジェクト: phamthaithinh/nomin
 protected void addOrReplace(ParsedMapping parsedMapping) {
   MappingKey key = new MappingKey(parsedMapping);
   for (int i = 0; i < mappings.size(); i++) {
     if (key.equals(new MappingKey(mappings.get(i)))) {
       logger.warn("{}\nis replaced with\n{}", mappings.get(i), parsedMapping);
       mappings.set(i, parsedMapping);
       return;
     }
   }
   logger.debug("Parsed {}", parsedMapping);
   mappings.add(parsedMapping);
 }
コード例 #3
0
ファイル: Nomin.java プロジェクト: phamthaithinh/nomin
 public Nomin disableAutomapping() {
   this.automappingEnabled = false;
   logger.debug("Nomin's automapping facility is disabled");
   return this;
 }
コード例 #4
0
ファイル: Nomin.java プロジェクト: phamthaithinh/nomin
 public Nomin enableAutomapping() {
   this.automappingEnabled = true;
   logger.debug("Nomin's automapping facility is enabled");
   return this;
 }
コード例 #5
0
ファイル: Nomin.java プロジェクト: phamthaithinh/nomin
 static {
   logger.info("Nomin Mapping Engine version {}", NOMIN_VERSION);
   ClassImprover.initialize();
 }