Package com.sun.codemodel
Interface JAnnotatable
-
- All Known Implementing Classes:
JAnnotationArrayMember
,JAnonymousClass
,JDefinedClass
,JEnumConstant
,JFieldVar
,JMethod
,JPackage
,JVar
public interface JAnnotatable
Annotatable program elements.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JAnnotationUse
annotate(JClass clazz)
Adds an annotation to this program element.JAnnotationUse
annotate(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
Adds an annotation to this program element.<W extends JAnnotationWriter>
Wannotate2(java.lang.Class<W> clazz)
Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.java.util.Collection<JAnnotationUse>
annotations()
Read-only live view of all annotations on thisJAnnotatable
-
-
-
Method Detail
-
annotate
JAnnotationUse annotate(JClass clazz)
Adds an annotation to this program element.- Parameters:
clazz
- The annotation class to annotate the program element with
-
annotate
JAnnotationUse annotate(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
Adds an annotation to this program element.- Parameters:
clazz
- The annotation class to annotate the program element with
-
annotate2
<W extends JAnnotationWriter> W annotate2(java.lang.Class<W> clazz)
Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.
-
annotations
java.util.Collection<JAnnotationUse> annotations()
Read-only live view of all annotations on thisJAnnotatable
- Returns:
- Can be empty but never null.
-
-