Package com.sun.codemodel
Class TypedAnnotationWriter<A extends Annotation,W extends JAnnotationWriter<A>>
java.lang.Object
com.sun.codemodel.TypedAnnotationWriter<A,W>
- All Implemented Interfaces:
JAnnotationWriter<A>
,InvocationHandler
class TypedAnnotationWriter<A extends Annotation,W extends JAnnotationWriter<A>>
extends Object
implements InvocationHandler, JAnnotationWriter<A>
Dynamically implements the typed annotation writer interfaces.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe annotation that we are writing.private Map
<String, JAnnotationArrayMember> Keeps track of writers for array members.private final JAnnotationUse
This is what we are writing to.The type of the writer. -
Constructor Summary
ConstructorsConstructorDescriptionTypedAnnotationWriter
(Class<A> annotation, Class<W> writer, JAnnotationUse use) -
Method Summary
Modifier and TypeMethodDescriptionprivate Object
private void
Check if the type of the argument matches our expectation.(package private) static <W extends JAnnotationWriter<?>>
Wcreate
(Class<W> w, JAnnotatable annotatable) Creates a new typed annotation writer.private W
Creates a proxy and returns it.private static Class
<? extends Annotation> findAnnotationType
(Class<?> clazz) The type of the annotation that this writer is writing.Gets the underlying annotation use object to which we are writing.
-
Field Details
-
use
This is what we are writing to. -
annotation
The annotation that we are writing. -
writerType
The type of the writer. -
arrays
Keeps track of writers for array members. Lazily created.
-
-
Constructor Details
-
TypedAnnotationWriter
-
-
Method Details
-
getAnnotationUse
Description copied from interface:JAnnotationWriter
Gets the underlying annotation use object to which we are writing.- Specified by:
getAnnotationUse
in interfaceJAnnotationWriter<A extends Annotation>
-
getAnnotationType
Description copied from interface:JAnnotationWriter
The type of the annotation that this writer is writing.- Specified by:
getAnnotationType
in interfaceJAnnotationWriter<A extends Annotation>
-
invoke
- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-
addArrayValue
-
checkType
Check if the type of the argument matches our expectation. If not, report an error. -
createProxy
Creates a proxy and returns it. -
create
Creates a new typed annotation writer. -
findAnnotationType
-