01: package com.bm.introspectors;
02:
03: public final class IntrospectorFactory {
04:
05: /**
06: * Constructor.
07: */
08: private IntrospectorFactory() {
09: }
10:
11: /**
12: * returns the right introspector.
13: *
14: * @author Daniel Wiese
15: * @since Jul 19, 2007
16: * @param forClass
17: * the right one for the class
18: * @return the introspector for the class.
19: */
20: @SuppressWarnings("unchecked")
21: public static AbstractIntrospector<?> createIntrospector(
22: Class forClass) {
23: if (SessionBeanIntrospector.accept(forClass)) {
24: return new SessionBeanIntrospector<Object>(forClass);
25: } else if (MDBIntrospector.accept(forClass)) {
26: return new MDBIntrospector<Object>(forClass);
27: } else if (JbossServiceIntrospector.accept(forClass)) {
28: return new JbossServiceIntrospector<Object>(forClass);
29: }
30:
31: throw new IllegalArgumentException("Introspector for class ("
32: + forClass + ") not found");
33: }
34: }
|