final AnnotationFinder af = (AnnotationFinder) ejbModule.getFinder();
final List<Class<?>> ancestors = Classes.ancestors(clazz);
ancestors.addAll(asList(clazz.getInterfaces()));
if (dynamicBean) {
final Proxy p = metaClass.getAnnotation(Proxy.class);
if (p != null) {
ancestors.add(p.value());
}
}
final String[] names = new String[ancestors.size()];
int i = 0;
for (final Class<?> ancestor : ancestors) {
names[i++] = ancestor.getName();
}
annotationFinder = af.select(names);
} else { // shouldn't occur
if (!dynamicBean) {
annotationFinder = createFinder(clazz);
} else {
final Class<?>[] classes;
final Proxy proxy = metaClass.getAnnotation(Proxy.class);
if (proxy == null) {
classes = new Class<?>[]{clazz};
} else {
classes = new Class<?>[]{clazz, proxy.value()};
}
annotationFinder = createFinder(classes);
}
}