Coverage Report - org.dozer.builder.DestBeanBuilderCreator
 
Classes in this File Line Coverage Branch Coverage Complexity
DestBeanBuilderCreator
30%
3/10
25%
1/4
2
 
 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.builder;
 17  
 
 18  
 import org.dozer.BeanBuilder;
 19  
 import org.dozer.factory.BeanCreationDirective;
 20  
 
 21  
 import java.util.ArrayList;
 22  
 import java.util.List;
 23  
 import java.util.concurrent.CopyOnWriteArrayList;
 24  
 
 25  
 /**
 26  
  * @author Dmitry Spikhalskiy
 27  
  */
 28  
 public class DestBeanBuilderCreator {
 29  
 
 30  
   //elements of this collections should have very specific isApplicable method to avoid application to class,
 31  
   //which should be processed by another builder
 32  1
   static final List<BeanBuilderCreationStrategy> pluggedStrategies = new ArrayList<BeanBuilderCreationStrategy>();
 33  
 
 34  0
   private DestBeanBuilderCreator() {
 35  0
   }
 36  
 
 37  
   public static BeanBuilder create(BeanCreationDirective directive) {
 38  41637
     for (BeanBuilderCreationStrategy strategy : new CopyOnWriteArrayList<BeanBuilderCreationStrategy>(pluggedStrategies)) {
 39  0
       if (strategy.isApplicable(directive)) {
 40  0
         return strategy.create(directive);
 41  
       }
 42  0
     }
 43  
 
 44  41637
     return null;
 45  
   }
 46  
 
 47  
   public static void addPluggedStrategy(BeanBuilderCreationStrategy beanBuilderCreationStrategy) {
 48  0
     pluggedStrategies.add(beanBuilderCreationStrategy);
 49  0
   }
 50  
 }