Coverage Report - org.dozer.classmap.ClassMapKeyFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
ClassMapKeyFactory
100%
14/14
100%
2/2
1.333
 
 1  
 /**
 2  
  * Copyright 2005-2013 Dozer Project
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.dozer.classmap;
 17  
 
 18  
 import org.apache.commons.lang3.StringUtils;
 19  
 import org.dozer.util.MappingUtils;
 20  
 
 21  
 /**
 22  
  * Internal class that generates a unique class mapping key. Only intended for internal use.
 23  
  * 
 24  
  * @author tierney.matt
 25  
  * @author garsombke.franz
 26  
  * @author dmitry.buzdin
 27  
  */
 28  
 public final class ClassMapKeyFactory {
 29  
 
 30  1324
   public ClassMapKeyFactory() {
 31  1324
   }
 32  
 
 33  
   public String createKey(Class<?> srcClass, Class<?> destClass) {
 34  11749
     return createKey(srcClass, destClass, null);
 35  
   }
 36  
 
 37  
   public String createKey(Class<?> srcClass, Class<?> destClass, String mapId) {
 38  195344
           Class<?> srcRealClass = MappingUtils.getRealClass(srcClass);
 39  195344
           Class<?> destRealClass = MappingUtils.getRealClass(destClass);
 40  
 
 41  
 
 42  195344
     StringBuilder result = new StringBuilder(140);
 43  195344
     result.append("SRC-CLASS->");
 44  195344
     result.append(srcRealClass.getName());
 45  195344
     result.append(" DST-CLASS->");
 46  195344
     result.append(destRealClass.getName());
 47  195344
     if (StringUtils.isNotEmpty(mapId)) {
 48  1449
       result.append(" MAP-ID->");
 49  1449
       result.append(mapId);
 50  
     }
 51  195344
     return result.toString();
 52  
   }
 53  
 
 54  
 }