01: package com.bm.ejb3metadata.annotations.analyzer.classes;
02:
03: import static com.bm.ejb3metadata.annotations.ClassType.SERVICE;
04:
05: import com.bm.ejb3metadata.annotations.analyzer.AnnotationType;
06: import com.bm.ejb3metadata.annotations.impl.JService;
07: import com.bm.ejb3metadata.annotations.metadata.ClassAnnotationMetadata;
08:
09: /**
10: * This class manages the handling of @{@link org.jboss.annotation.ejb.Service}
11: * annotation.
12: * @author Daniel Wiese
13: */
14: public class JBossEjbServiceVisitor extends
15: AbsCommonEjbVisitor<JService> implements AnnotationType {
16:
17: /**
18: * Type of annotation.
19: */
20: public static final String TYPE = "Lorg/jboss/annotation/ejb/Service;";
21:
22: /**
23: * Constructor.
24: * @param classAnnotationMetadata linked to a class metadata
25: */
26: public JBossEjbServiceVisitor(
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(SERVICE);
38: }
39:
40: /**
41: * @return the object representing common bean.
42: */
43: @Override
44: public JService getJCommonBean() {
45: JService jService = getAnnotationMetadata().getJService();
46: if (jService == null) {
47: jService = new JService();
48: getAnnotationMetadata().setJService(jService);
49: }
50: return jService;
51: }
52:
53: /**
54: * @return type of the annotation (its description)
55: */
56: public String getType() {
57: return TYPE;
58: }
59:
60: }
|