01: package com.bm.introspectors;
02:
03: import org.jboss.annotation.ejb.Consumer;
04:
05: import com.bm.ejb3metadata.annotations.metadata.ClassAnnotationMetadata;
06: import com.bm.ejb3metadata.annotations.metadata.MetaDataCache;
07:
08: /**
09: * Introspector for MDB (supports also jboss mdb.
10: * @author Daniel Wiese
11: * @since 24.03.2007
12: * @param <T> the type
13: */
14: public class MDBIntrospector<T> extends AbstractIntrospector<T> {
15:
16: /**
17: * Constructor.
18: * @param toInspect the class to inspect
19: */
20: public MDBIntrospector(Class<? extends T> toInspect) {
21: super (toInspect);
22:
23: boolean isSessionBean = accept(toInspect);
24: if (!isSessionBean) {
25: throw new RuntimeException("The class is not a mdb bean");
26: }
27:
28: // FIXME: distinguish between field and method based annotations
29: // analyse the fields
30: this .processAccessTypeField(toInspect);
31:
32: }
33:
34: /**
35: * Returns true is this intorspector accept this class.
36: *
37: * @param toCheck -
38: * to check
39: * @return true id the introspector will accept this class
40: */
41: @SuppressWarnings("unchecked")
42: public static boolean accept(Class toCheck) {
43: ClassAnnotationMetadata classMeta = MetaDataCache
44: .getMetaData(toCheck);
45: return classMeta.isMdb()
46: || (toCheck.getAnnotation(Consumer.class) != null);
47: }
48: }
|