java - What's the conception behind: Type - Element - Mirror -
I am working with the annotation processing of Java 6, i.e. javax.annotation.processing
(No APT of Java 5).
I wonder what is the transitional difference between different For example, let me know element
, type
, and mirror
AnnotationMirror
. When I call getAnnotationType ()
, I get an example of declared type
(for whatever reason TypeMirror
applies).
So I can call asElement ()
on this and get an example of Element
.
What happened?
type of object javax.lang.model.element.AnnotationMirror
your code Represents an annotation in
The declared type annotation class represents.
Its element is the general category (see for more information on that topic) Element can be a generic version of a class, such as list
, where the declared type of parametric version Is, for example list & lt; String & gt;
. Although I'm not sure whether it is possible to use Generation Generation Annotation classes and thus the distinction between that context may be inconsistent. For example, tell you that you have the following JUnit4 method:
@Test (expected = MyException.class) Public zero myTest () {// do some tests on some classes. ..}
represents annotation mirror @Test (expected = NullPointerException.class)
. The declared type is org.junit.Test
class. The element is more or less similar because there is no generic involved in it.
Comments
Post a Comment