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