Coverage Report - org.dozer.util.DefaultClassLoader
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultClassLoader
100%
11/11
N/A
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.util;
 17  
 
 18  
 import org.apache.commons.lang3.ClassUtils;
 19  
 
 20  
 import java.net.URL;
 21  
 
 22  
 /**
 23  
  *
 24  
  *
 25  
  * @author dmitry.buzdin
 26  
  * @since 5.1
 27  
  */
 28  
 public class DefaultClassLoader implements DozerClassLoader {
 29  
 
 30  
   private final ClassLoader classLoader;
 31  
   private final ResourceLoader resourceLoader;
 32  
 
 33  2
   public DefaultClassLoader(ClassLoader classLoader) {
 34  2
     this.classLoader = classLoader;
 35  2
     this.resourceLoader = new ResourceLoader(classLoader);
 36  2
   }
 37  
 
 38  
   public Class<?> loadClass(String className)  {
 39  23712
     Class<?> result = null;
 40  
     try {
 41  23712
             result = ClassUtils.getClass(classLoader, className);
 42  4
     } catch (ClassNotFoundException e) {
 43  4
       MappingUtils.throwMappingException(e);
 44  23708
     }
 45  23708
     return result;
 46  
   }
 47  
 
 48  
   public URL loadResource(String uri) {
 49  1216
     return resourceLoader.getResource(uri);
 50  
   }
 51  
 
 52  
 }