01: package com.bm.ejb3metadata.annotations.analyzer.method;
02:
03: import com.bm.ejb3metadata.annotations.analyzer.AbsAnnotationVisitor;
04: import com.bm.ejb3metadata.annotations.analyzer.AnnotationType;
05: import com.bm.ejb3metadata.annotations.metadata.MethodAnnotationMetadata;
06:
07: /**
08: * This class manages the handling of @{@link javax.annotation.PreDestroy} annotation.
09: * @author Daniel Wiese
10: */
11: public class JavaxAnnotationPreDestroyVisitor extends
12: AbsAnnotationVisitor<MethodAnnotationMetadata> implements
13: AnnotationType {
14:
15: /**
16: * Type of annotation.
17: */
18: public static final String TYPE = "Ljavax/annotation/PreDestroy;";
19:
20: /**
21: * Constructor.
22: * @param methodAnnotationMetadata linked to a method metadata
23: */
24: public JavaxAnnotationPreDestroyVisitor(
25: final MethodAnnotationMetadata methodAnnotationMetadata) {
26: super (methodAnnotationMetadata);
27: }
28:
29: /**
30: * Visits the end of the annotation. <br>
31: * Creates the object and store it.
32: */
33: @Override
34: public void visitEnd() {
35: getAnnotationMetadata().setPreDestroy(true);
36: // set method on super class
37: getAnnotationMetadata().getClassAnnotationMetadata()
38: .addPreDestroyMethodMetadata(getAnnotationMetadata());
39:
40: }
41:
42: /**
43: * @return type of the annotation (its description)
44: */
45: public String getType() {
46: return TYPE;
47: }
48:
49: }
|