本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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());
}
示例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);
}
}