01: package com.bm.ejb3metadata.annotations.analyzer.classes;
02:
03: import static com.bm.ejb3metadata.annotations.ClassType.STATEFUL;
04:
05: import com.bm.ejb3metadata.annotations.analyzer.AnnotationType;
06: import com.bm.ejb3metadata.annotations.impl.JStateful;
07: import com.bm.ejb3metadata.annotations.metadata.ClassAnnotationMetadata;
08:
09: /**
10: * This class manages the handling of @{@link javax.ejb.Stateful}
11: * annotation.
12: * @author Daniel Wiese
13: */
14: public class JavaxEjbStatefulVisitor extends
15: AbsCommonEjbVisitor<JStateful> implements AnnotationType {
16:
17: /**
18: * Type of annotation.
19: */
20: public static final String TYPE = "Ljavax/ejb/Stateful;";
21:
22: /**
23: * Constructor.
24: * @param classAnnotationMetadata linked to a class metadata
25: */
26: public JavaxEjbStatefulVisitor(
27: final ClassAnnotationMetadata classAnnotationMetadata) {
28: super (classAnnotationMetadata);
29: }
30:
31: /**
32: * Visits the end of the annotation. <br> Creates the object and store it.
33: */
34: @Override
35: public void visitEnd() {
36: super .visitEnd();
37: getAnnotationMetadata().setClassType(STATEFUL);
38: }
39:
40: /**
41: * @return the object representing common bean.
42: */
43: @Override
44: public JStateful getJCommonBean() {
45: JStateful jStateful = getAnnotationMetadata().getJStateful();
46: if (jStateful == null) {
47: jStateful = new JStateful();
48: getAnnotationMetadata().setJStateful(jStateful);
49: }
50: return jStateful;
51: }
52:
53: /**
54: * @return type of the annotation (its description)
55: */
56: public String getType() {
57: return TYPE;
58: }
59:
60: }
|