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