Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SpiMetaRegistry |
|
| 1.0;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.spi.model; | |
15 | ||
16 | import java.io.IOException; | |
17 | import java.io.InputStream; | |
18 | import java.net.URL; | |
19 | ||
20 | import org.apache.commons.classscan.ClassPathElement; | |
21 | import org.apache.commons.classscan.MetaClassPathElement; | |
22 | import org.apache.commons.classscan.MetaRegistry; | |
23 | import org.apache.commons.classscan.spi.ClassPathElementFactory; | |
24 | ||
25 | /** | |
26 | * The entry point for providers to find/create information about the ClassPath and the classes | |
27 | * available from the ClassPath. | |
28 | */ | |
29 | public interface SpiMetaRegistry extends MetaRegistry { | |
30 | ||
31 | /** | |
32 | * Create SpiMetaClassPathElement from a ClassPathElement. The ClassPathElement has | |
33 | * just the raw class path definition. The SpiMetaClassPathElement contains the | |
34 | * metadata about classes available at the class path location. | |
35 | * | |
36 | * @param pathElement A location in the class path | |
37 | * @return metadata for classes available at the given location | |
38 | */ | |
39 | SpiMetaClassPathElement createMetaClassPathElement(ClassPathElement pathElement); | |
40 | ||
41 | /** | |
42 | * Create SpiMetaClass from a MetaClassPathElement. The MetaClassPathElement has | |
43 | * the metadata about a base location. The SpiMetaClass contains the | |
44 | * metadata about the class defined in a stream of bytes. | |
45 | * | |
46 | * @param metaClassPathElement The location of a class | |
47 | * @param className The canonical name of the class | |
48 | * @param byteStream The byte stream containing the class definition. This stream should be closed when finished. | |
49 | * @return The metadata about the class in the stream | |
50 | * | |
51 | * @throws IOException | |
52 | */ | |
53 | SpiMetaClass createMetaClass(MetaClassPathElement metaClassPathElement, String className, InputStream byteStream) throws IOException; | |
54 | ||
55 | /** | |
56 | * Create a ClassPathElement from a URL. The registry will invoke {@link ClassPathElementFactory}(s) | |
57 | * sequentially until a factory returns a ClassPathElement for the given URL. | |
58 | * | |
59 | * @param url The base location of the class files | |
60 | * @return null, if no ClassPathElementFactory supports the given URL; otherwise, a ClassPathElement | |
61 | * @throws IOException | |
62 | */ | |
63 | SpiClassPathElement createClassPathElement(URL url) throws IOException; | |
64 | } |