本文整理汇总了Java中org.apache.xbean.finder.AnnotationFinder.findMetaAnnotatedMethods方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationFinder.findMetaAnnotatedMethods方法的具体用法?Java AnnotationFinder.findMetaAnnotatedMethods怎么用?Java AnnotationFinder.findMetaAnnotatedMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xbean.finder.AnnotationFinder
的用法示例。
在下文中一共展示了AnnotationFinder.findMetaAnnotatedMethods方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processAsynchronous
import org.apache.xbean.finder.AnnotationFinder; //导入方法依赖的package包/类
private void processAsynchronous(final EnterpriseBean bean, final AnnotationFinder annotationFinder) {
if (!(bean instanceof SessionBean)) {
return;
}
final SessionBean sessionBean = (SessionBean) bean;
for (final Annotated<Method> method : annotationFinder.findMetaAnnotatedMethods(Asynchronous.class)) {
sessionBean.getAsyncMethod().add(new AsyncMethod(method.get()));
}
//Spec 4.5.1 @Asynchronous could be used at the class level of a bean-class ( or superclass ).
//Seems that it should not be used on the any interface view
for (final Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(Asynchronous.class)) {
if (!clazz.get().isInterface()) {
sessionBean.getAsynchronousClasses().add(clazz.get().getName());
}
}
}
示例2: testSortMethods
import org.apache.xbean.finder.AnnotationFinder; //导入方法依赖的package包/类
@Test
public void testSortMethods() throws Exception {
final AnnotationFinder finder = new AnnotationFinder(new ClassesArchive(Emerald.class)).link();
final List<Annotated<Method>> classes = finder.findMetaAnnotatedMethods(Resource.class);
assertTrue(classes.size() >= 3);
final List<Annotated<Method>> sorted = AnnotationDeployer.sortMethods(classes);
assertTrue(sorted.size() >= 3);
assertEquals(Emerald.class, sorted.get(0).get().getDeclaringClass());
assertEquals(Green.class, sorted.get(1).get().getDeclaringClass());
assertEquals(Color.class, sorted.get(2).get().getDeclaringClass());
}