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.PostConstruct} annotation.
09: * @author Daniel Wiese
10: */
11: public class JavaxAnnotationPostConstructVisitor extends
12: AbsAnnotationVisitor<MethodAnnotationMetadata> implements
13: AnnotationType {
14:
15: /**
16: * Type of annotation.
17: */
18: public static final String TYPE = "Ljavax/annotation/PostConstruct;";
19:
20: /**
21: * Constructor.
22: * @param methodAnnotationMetadata linked to a method metadata
23: */
24: public JavaxAnnotationPostConstructVisitor(
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().setPostConstruct(true);
36: // set method on super class
37: getAnnotationMetadata()
38: .getClassAnnotationMetadata()
39: .addPostConstructMethodMetadata(getAnnotationMetadata());
40:
41: }
42:
43: /**
44: * @return type of the annotation (its description).
45: */
46: public String getType() {
47: return TYPE;
48: }
49:
50: }
|