Coverage Report - org.apache.commons.classscan.MetaClassLoader
 
Classes in this File Line Coverage Branch Coverage Complexity
MetaClassLoader
N/A
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;
 15  
 
 16  
 import java.util.Collection;
 17  
 import java.util.Iterator;
 18  
 
 19  
 import org.apache.commons.classscan.model.MetaClass;
 20  
 
 21  
 /**
 22  
  * Metadata about a ClassLoader. This includes the jars that a ClassLoader loads
 23  
  * from and the Classes that are potentially available.
 24  
  */
 25  
 public interface MetaClassLoader {
 26  
     /**
 27  
      * Get the metadata about the parent of the associated ClassLoader.
 28  
      * 
 29  
      * @return The parent metadata. This will be null if the associated
 30  
      *         ClassLoader is the primordial ClassLoader.
 31  
      */
 32  
     MetaClassLoader getParent();
 33  
 
 34  
     /**
 35  
      * Get metadata about the locations from which the associated ClassLoader
 36  
      * loads Classes.
 37  
      * 
 38  
      * @return A read-only set of code locations
 39  
      */
 40  
     Collection<? extends MetaClassPathElement> getClassLocations();
 41  
 
 42  
     /**
 43  
      * Get metadata about a class locations
 44  
      * 
 45  
      * @param codeLocation
 46  
      *            The location of a folder, jar, or compressed code
 47  
      */
 48  
     MetaClassPathElement getClassLocation(String codeLocation);
 49  
 
 50  
     /**
 51  
      * Get metadata about the Classes from which the associated ClassLoader can
 52  
      * load.
 53  
      * 
 54  
      * @return A read-only set of class information
 55  
      */
 56  
     Iterator<? extends MetaClass> getMetaClasses();
 57  
 
 58  
     /**
 59  
      * Get metadata about a particular Class. This method will return only
 60  
      * classes defined by the associated ClassLoader. Classes defined by a
 61  
      * parent ClassLoader can be found using {@link #findMetaClass}.
 62  
      * 
 63  
      * @param className
 64  
      *            The name of the Class
 65  
      * @return The metadata about the Class; or null, if the class was not
 66  
      *         available to the associated ClassLoader
 67  
      */
 68  
     MetaClass getMetaClass(String className);
 69  
 
 70  
     /**
 71  
      * Find metadata about a particular Class. This method will first search up
 72  
      * the associated parent ClassLoader chain.
 73  
      * 
 74  
      * @param className
 75  
      *            The name of the Class
 76  
      * @return The metadata about the Class; or null, if the class was not
 77  
      *         available to the associated ClassLoader not its parent chain
 78  
      */
 79  
     MetaClass findMetaClass(String className);
 80  
 
 81  
     /**
 82  
      * Find all the implementors of an interface class. This method will search
 83  
      * in the associated ClassLoader and all parents.
 84  
      * 
 85  
      * @param interfaceToFind
 86  
      *            The non-null MetaClass associated with the
 87  
      * 
 88  
      * @return All discovered implementors of the desired interface
 89  
      */
 90  
     Collection<? extends MetaClass> findAllImplementors(String interfaceToFind);
 91  
 }