当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationDB.getAnnotationIndex方法代码示例

本文整理汇总了Java中org.scannotation.AnnotationDB.getAnnotationIndex方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationDB.getAnnotationIndex方法的具体用法?Java AnnotationDB.getAnnotationIndex怎么用?Java AnnotationDB.getAnnotationIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.scannotation.AnnotationDB的用法示例。


在下文中一共展示了AnnotationDB.getAnnotationIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findSetupTeardownClasses

import org.scannotation.AnnotationDB; //导入方法依赖的package包/类
/**
 * Search classpath and init TestSetupTeardown classes.
 */
private static void findSetupTeardownClasses() {
    AnnotationDB db = new AnnotationDB();
    try {
        URL[] urls = ClasspathUrlFinder.findClassPaths();
        db.scanArchives(urls);
        Map<String, Set<String>> annotationIndex = db.getAnnotationIndex();

        for (String cls : annotationIndex.get(FeatureSetupTeardown.class.getName())) {
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            Class<?> setup = cl.loadClass(cls);
            FeatureSetupTeardown anno = setup.getAnnotation(FeatureSetupTeardown.class);
            if (setupTeardownRegistry.get(anno.value().getName()) != null) {
                if (!cls.toLowerCase().contains("default")) {
                    setupTeardownRegistry.put(anno.value().getName(), setup);
                }
            } else {
                setupTeardownRegistry.put(anno.value().getName(), setup);
            }

        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:deephacks,项目名称:confit,代码行数:28,代码来源:FeatureTestsBuilder.java

示例2: index

import org.scannotation.AnnotationDB; //导入方法依赖的package包/类
private synchronized Map<String, Set<String>> index() {
    if (index == null) {
        final AnnotationDB db = new AnnotationDB();
        try {
            db.scanArchives(urls);
        } catch (final IOException e) {
            throw new TestEEfiException("Failed to perform annotation scanning", e);
        }
        index = db.getAnnotationIndex();

    }
    return index;
}
 
开发者ID:dajudge,项目名称:testee.fi,代码行数:14,代码来源:AnnotationScanner.java

示例3: findEntityClassNames

import org.scannotation.AnnotationDB; //导入方法依赖的package包/类
private Set<String> findEntityClassNames() throws IOException {
	AnnotationDB annotationDB = new AnnotationDB();
	annotationDB.setScanClassAnnotations(true);
	annotationDB.scanArchives(ClasspathUrlFinder.findClassPaths());
	Map<String, Set<String>> map = annotationDB.getAnnotationIndex();
	Set<String> classNames = map.get(Entity.class.getName());

	return classNames;
}
 
开发者ID:makersoft,项目名称:mybatis-activesql,代码行数:10,代码来源:ActiveSQLSessionFactoryBean.java

示例4: scanForAnnotations

import org.scannotation.AnnotationDB; //导入方法依赖的package包/类
private static Entries scanForAnnotations(URL[] urls) {
    AnnotationDB db = new AnnotationDB();
    try {
        db.scanArchives(urls);
    } catch (IOException e) {
        throw Throwables.propagate(e);
    }

    Map<String,Set<String>> annotationIndex = db.getAnnotationIndex();
    Set<String> types = annotationIndex.get(Stable.class.getName());
    return new Entries(types, Collections.<String>emptyList());
}
 
开发者ID:buzdin,项目名称:apilution,代码行数:13,代码来源:SigfileCreate.java

示例5: getDescriptor

import org.scannotation.AnnotationDB; //导入方法依赖的package包/类
@Override
public FixedPropertyDescriptor getDescriptor () throws EsfingeAOMException
{
	try
	{
		FixedPropertyDescriptor descriptor = new FixedPropertyDescriptor();
		URL[] urls = ClasspathUrlFinder.findClassPaths(); 
		AnnotationDB db = new AnnotationDB();
		db.setScanFieldAnnotations(true);
		db.setScanClassAnnotations(false);
		db.setScanMethodAnnotations(false);
		db.setScanParameterAnnotations(false);			
		db.scanArchives(urls);
		Map<String, Set<String>> annotations = db.getAnnotationIndex();
		for (String clazz : annotations.get(FixedEntityProperty.class.getName()))
		{
			Class<?> c = Class.forName(clazz);				
			if (c.isAnnotationPresent(Entity.class))
			{
				Class<?> type = null;
				List<Field> fixedProperties = new ArrayList<Field>();
				for (Field f : c.getDeclaredFields())
				{
					if (f.isAnnotationPresent(EntityType.class))
					{
						type = f.getType();
					}
					else if (f.isAnnotationPresent(FixedEntityProperty.class))
					{
						fixedProperties.add(f);
					}
				}
				if (type != null && fixedProperties.size() > 0)
				{
					descriptor.addFixedProperty(type, fixedProperties);
				}
			}
		}
		return descriptor;
	}
	catch (Exception e)
	{
		throw new EsfingeAOMException(e);
	}
}
 
开发者ID:EsfingeFramework,项目名称:aomrolemapper,代码行数:46,代码来源:FixedPropertyAnnotationReader.java


注:本文中的org.scannotation.AnnotationDB.getAnnotationIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。