Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MetaClass |
|
| 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.model; | |
15 | ||
16 | import java.util.Set; | |
17 | ||
18 | import org.apache.commons.classscan.HasName; | |
19 | import org.apache.commons.classscan.MetaClassPathElement; | |
20 | ||
21 | /** | |
22 | * Metadata about a class or primitive type | |
23 | */ | |
24 | public interface MetaClass extends HasName, MetaType { | |
25 | /** | |
26 | * Get the ClassLocation from which the corresponding class came. For | |
27 | * primitive types, this will return null. | |
28 | */ | |
29 | MetaClassPathElement getClassLocation(); | |
30 | ||
31 | /** | |
32 | * Get the canonical name of the corresponding Class. For primitive types, | |
33 | * this will be the primitive type name. e.g. char | |
34 | */ | |
35 | String getName(); | |
36 | ||
37 | /** | |
38 | * Get metadata about the corresponding Class's parent | |
39 | * | |
40 | * @return The MetaClass, or null if the corresponding Class is a primitive | |
41 | * type or Object.class | |
42 | */ | |
43 | MetaClass getParent(); | |
44 | ||
45 | /** | |
46 | * Get metadata about the interfaces which the corresponding Class | |
47 | * implements. No inherited interfaces will be in the set. | |
48 | * | |
49 | * @return A read-only set of the interface information | |
50 | */ | |
51 | Set<? extends MetaClass> getInterfaces(); | |
52 | ||
53 | /** | |
54 | * Get metadata about the annotations on the corresponding Class. | |
55 | * | |
56 | * @return A read-only set of the annotation information | |
57 | */ | |
58 | Set<? extends MetaAnnotation> getAnnotations(); | |
59 | ||
60 | /** | |
61 | * Get metadata about a particular annotation on the corresponding Class. | |
62 | * | |
63 | * @param annotationName | |
64 | * The name of the annotation desired | |
65 | * | |
66 | * @return The annotation information, or null if not specified on the | |
67 | * corresponding Class | |
68 | */ | |
69 | MetaAnnotation getAnnotation(String annotationName); | |
70 | ||
71 | /** | |
72 | * Get metadata about the corresponding Class's methods and constructors. No | |
73 | * inherited methods will be in the set. | |
74 | * | |
75 | * @return A read-only set of the method information | |
76 | */ | |
77 | Set<? extends MetaMethod> getMethods(); | |
78 | ||
79 | /** | |
80 | * Get metadata about the corresponding Class's methods and constructors. No | |
81 | * inherited fields will be in the set. | |
82 | * | |
83 | * @return A read-only set of the field information | |
84 | */ | |
85 | Set<? extends MetaField> getFields(); | |
86 | ||
87 | /** | |
88 | * Is the associated Class assignable from the class associated with the | |
89 | * given MetaClass. | |
90 | * | |
91 | * @param assignor | |
92 | * The non-null MetaClass (associated with class or interface) | |
93 | * @return true, if and only if instances represented by implementor can be | |
94 | * assigned to instances represented by this MetaClass | |
95 | */ | |
96 | boolean isAssignableFrom(MetaClass assignor); | |
97 | } |