repository.grepcode.com$java$root@jdk$openjdk@6-b14
repository.grepcode.com$java$root@jdk$openjdk@6-b14@java$lang$annotation$ElementType.java
file
oh
o
[]
What does following annotation's ElementType means?
@Entity
@Table(table="application")
@ElementType(type=1L)
class application extends Element
java.lang.annotation.ElementType:
A program element type. The constants of this enumerated type provide a simple classification of the declared elements in a Java program. These constants are used with the Target meta-annotation type to specify where it is legal to use an annotation type.
There are the following constants:
ANNOTATION_TYPE - Annotation type declaration
CONSTRUCTOR - Construc...
According to the class ElementType in the API, you can annotate local variables and method parameters.
How is that done?
Try to write:
List<Object> list;
@SuppressWarnings("unchecked")
list = (List<Object>) new Object();
It will fail on the 3rd line, on the word list, with the following:
list cannot be resolved to a type
I understand that it is related to how annotations work. Anybody knows the reasoning behind this?
EDIT: thanks for the fast answer. I knew it'd work if the assignment was made a...
package java.lang.annotation;
A program element type. The constants of this enumerated type
provide a simple classification of the declared elements in a
Java program.
These constants are used with the Target meta-annotation type
to specify where it is legal to use an annotation type.
- Author(s):
- Joshua Bloch
- Since:
- 1.5
Class, interface (including annotation type), or enum declaration
Field declaration (includes enum constants)
Local variable declaration
Annotation type declaration