Coverage Report - org.apache.commons.classscan.builtin.BootstrapMetaClassLoader
 
Classes in this File Line Coverage Branch Coverage Complexity
BootstrapMetaClassLoader
0%
0/10
N/A
1
BootstrapMetaClassLoader$1
0%
0/6
N/A
1
 
 1  
 /*
 2  
  * Licensed under the Apache License, Version 2.0 (the "License");
 3  
  * you may not use this file except in compliance with the License.
 4  
  * You may obtain a copy of the License at
 5  
  *
 6  
  *      http://www.apache.org/licenses/LICENSE-2.0
 7  
  *
 8  
  * Unless required by applicable law or agreed to in writing, software
 9  
  * distributed under the License is distributed on an "AS IS" BASIS,
 10  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 11  
  * See the License for the specific language governing permissions and
 12  
  * limitations under the License.
 13  
  */
 14  
 package org.apache.commons.classscan.builtin;
 15  
 
 16  
 import java.util.Collection;
 17  
 
 18  
 import org.apache.commons.classscan.model.MetaClass;
 19  
 import org.apache.commons.classscan.spi.model.SpiMetaClassLoader;
 20  
 import org.apache.commons.classscan.spi.model.SpiMetaClassPathElement;
 21  
 import org.apache.commons.classscan.spi.model.SpiMetaRegistry;
 22  
 import org.apache.commons.classscan.util.NameSet;
 23  
 
 24  
 public class BootstrapMetaClassLoader extends UrlMetaClassLoader {
 25  
 
 26  
     BootstrapMetaClassLoader(SpiMetaRegistry registry) {
 27  0
         super(registry, null);
 28  0
     }
 29  
 
 30  
     @Override
 31  
         void addLocations(SpiMetaRegistry registry, ClassLoader classLoader) {
 32  0
             SpiMetaClassPathElement primitives= getPrimitiveClassPathElement();
 33  0
             addLocation(primitives);
 34  0
         super.addLocations(registry, classLoader);
 35  0
     }
 36  
 
 37  
         private SpiMetaClassPathElement getPrimitiveClassPathElement() {
 38  0
             final NameSet<PrimitiveClass> primitives = new NameSet<PrimitiveClass>(PrimitiveClass.values());
 39  
 
 40  0
             return new SpiMetaClassPathElement() {
 41  
 
 42  
                         @Override
 43  
                         public Collection<? extends MetaClass> getMetaClasses() {
 44  0
                                 return primitives;
 45  
                         }
 46  
 
 47  
                         @Override
 48  
                         public MetaClass getMetaClass(String className) {
 49  0
                                 return primitives.getValue(className);
 50  
                         }
 51  
 
 52  
                         @Override
 53  
                         public String getName() {
 54  0
                                 return "<builtin-primitives>";
 55  
                         }
 56  
 
 57  
                         @Override
 58  
                         public boolean resolve(SpiMetaClassLoader classLoader) {
 59  0
                                 return true;
 60  
                         }
 61  
 
 62  
                         @Override
 63  
                         public MetaClass resolveMetaClass(SpiMetaClassLoader classLoader, String className) {
 64  0
                                 return primitives.getValue(className);
 65  
                         }
 66  
             };
 67  
         }
 68  
 
 69  
     @Override
 70  
     public MetaClass findMetaClass(String className) {
 71  0
         return getMetaClass(className);
 72  
     }
 73  
 
 74  
     @Override
 75  
     public MetaClass resolveMetaClass(String className) {
 76  0
             return resolveInPath(className);
 77  
     }
 78  
 }