001 /* 002 * Licensed under the Apache License, Version 2.0 (the "License"); 003 * you may not use this file except in compliance with the License. 004 * You may obtain a copy of the License at 005 * 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * 008 * Unless required by applicable law or agreed to in writing, software 009 * distributed under the License is distributed on an "AS IS" BASIS, 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 011 * See the License for the specific language governing permissions and 012 * limitations under the License. 013 */ 014 package org.apache.commons.classscan.spi; 015 016 import java.util.ServiceLoader; 017 018 import org.apache.commons.classscan.spi.model.SpiClassPath; 019 import org.apache.commons.classscan.spi.model.SpiMetaRegistry; 020 021 /** 022 * Provider to create SpiClassPath for a ClassLoader. Provider instances should 023 * be registered using the {@link ServiceLoader} facility. Each provider class 024 * should have a public default constructor. A single instance of each provider 025 * class will be instantiated. 026 */ 027 public interface ClassPathFactory { 028 /** 029 * Create a ClassPath for a ClassLoader 030 * 031 * @param metaRegistry The registry 032 * @param classLoader The classLoader 033 * @return null, if the ClassLoader type cannot be supported; otherwise a ClassPath for the ClassLoader 034 */ 035 SpiClassPath getClassPath(SpiMetaRegistry metaRegistry, ClassLoader classLoader); 036 }