Coverage Report - org.dozer.DozerBeanMapperSingletonWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
DozerBeanMapperSingletonWrapper
71%
5/7
100%
2/2
1.5
 
 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;
 17  
 
 18  
 import org.dozer.util.DozerConstants;
 19  
 
 20  
 import java.util.ArrayList;
 21  
 import java.util.List;
 22  
 
 23  
 
 24  
 /**
 25  
  * Public Singleton wrapper for the DozerBeanMapper. Only supports a single mapping file named dozerBeanMapping.xml, so
 26  
  * configuration is very limited. Instead of using the DozerBeanMapperSingletonWrapper, it is recommended that the
 27  
  * DozerBeanMapper(MapperIF) instance is configured via an IOC framework, such as Spring, with singleton property set to
 28  
  * "true"
 29  
  * 
 30  
  * @author garsombke.franz
 31  
  */
 32  
 public class DozerBeanMapperSingletonWrapper {
 33  
 
 34  
   private static Mapper instance;
 35  
 
 36  0
   private DozerBeanMapperSingletonWrapper() {
 37  0
   }
 38  
 
 39  
   public static synchronized Mapper getInstance() {
 40  2
     if (instance == null) {
 41  1
       List<String> mappingFiles = new ArrayList<String>();
 42  1
       mappingFiles.add(DozerConstants.DEFAULT_MAPPING_FILE);
 43  1
       instance = new DozerBeanMapper(mappingFiles);
 44  
     }
 45  2
     return instance;
 46  
   }
 47  
 }