Top Description Methods
com.sun.codemodel

public Interface JAnnotatable

Known Direct Implementers
com.sun.codemodel.JAnnotationArrayMember, com.sun.codemodel.JDefinedClass, com.sun.codemodel.JMethod, com.sun.codemodel.JModule, com.sun.codemodel.JPackage, com.sun.codemodel.JVar, com.sun.codemodel.JEnumConstant
Imports
java.lang.annotation.Annotation, java.util.Collection

Annotatable program elements.
Author
Kohsuke Kawaguchi

Method Summary

Modifier and TypeMethod and Description
public JAnnotationUse
annotate(JClass
The annotation class to annotate the program element with
clazz
)

Adds an annotation to this program element.

public JAnnotationUse
annotate(Class<? extends Annotation>
The annotation class to annotate the program element with
clazz
)

Adds an annotation to this program element.

public <W extends JAnnotationWriter<? extends Annotation>> W
annotate2(Class<W> clazz)

Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.

public Collection<JAnnotationUse>

Returns:

Can be empty but never null.
annotations
()

Read-only live view of all annotations on this

public boolean
removeAnnotation(JAnnotationUse
The annotation to be removed from the program element
annotation
)

Removes annotation from this program element.

Method Detail

annotateback to summary
public JAnnotationUse annotate(JClass clazz)

Adds an annotation to this program element.

Parameters
clazz:JClass

The annotation class to annotate the program element with

annotateback to summary
public JAnnotationUse annotate(Class<? extends Annotation> clazz)

Adds an annotation to this program element.

Parameters
clazz:Class<? extends Annotation>

The annotation class to annotate the program element with

annotate2back to summary
public <W extends JAnnotationWriter<? extends Annotation>> W annotate2(Class<W> clazz)

Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.

annotationsback to summary
public Collection<JAnnotationUse> annotations()

Read-only live view of all annotations on this

Returns:Collection<JAnnotationUse>

Can be empty but never null.

removeAnnotationback to summary
public boolean removeAnnotation(JAnnotationUse annotation)

Removes annotation from this program element.

Parameters
annotation:JAnnotationUse

The annotation to be removed from the program element