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


Java AnnotationDB类代码示例

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


AnnotationDB类属于org.scannotation包,在下文中一共展示了AnnotationDB类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createDB

import org.scannotation.AnnotationDB; //导入依赖的package包/类
/**
 * Create the annotation database from the given URLs.
 * @param urls the urls to use
 */
protected synchronized void createDB(URL[] urls) {
    try {
        long start = System.currentTimeMillis();

        annotationDB = new AnnotationDB();
        annotationDB.scanArchives(urls);

        long time = System.currentTimeMillis() - start;
        logger.warning("Scanned classes in " + time + " ms.");
    } catch (IOException ioe) {
        logger.log(Level.WARNING, "Error scanning " +
                   Arrays.toString(urls) + " for annotation", ioe);
    }
}
 
开发者ID:josmas,项目名称:openwonderland,代码行数:19,代码来源:ScannedClassLoader.java

示例4: discover

import org.scannotation.AnnotationDB; //导入依赖的package包/类
/**
 * Discovers available plug-ins using a given array of URLs.
 *
 * @param urls URLs where the {@link PluginManager} should look for URLs
 * @return Number of plug-ins discovered
 */
public int discover(URL... urls) {
    for (URL url : urls) {
        LOG.log(Level.INFO, "Discovering plug-ins in {0}", url.toString());
    }

    int discoveredPlugins = 0;
    AnnotationDB db = new AnnotationDB();

    try {
        db.scanArchives(urls);
        LOG.log(Level.INFO, "{0} different annotations found", db.getAnnotationIndex().size());
        for (String key : db.getAnnotationIndex().keySet()) {
            LOG.log(Level.INFO, "Annotation: {0} of {1} found", new Object[]{db.getAnnotationIndex().get(key).size(), key});
        }

        discoveredPlugins += discoverPlugins(db, dk.i2m.converge.core.annotations.NewswireDecoder.class, newswireDecoders);
        discoveredPlugins += discoverPlugins(db, dk.i2m.converge.core.annotations.WorkflowAction.class, workflowActions);
        discoveredPlugins += discoverPlugins(db, dk.i2m.converge.core.annotations.OutletAction.class, outletActions);
        discoveredPlugins += discoverPlugins(db, dk.i2m.converge.core.annotations.WorkflowValidator.class, workflowValidators);
        discoveredPlugins += discoverPlugins(db, dk.i2m.converge.core.annotations.CatalogueAction.class, catalogueActions);
        discoveredPlugins += discoverPlugins(db, dk.i2m.converge.core.annotations.NewsItemAction.class, newsItemActions);
        LOG.log(Level.INFO, "{0} {0, choice, 0#plugins|1#plugin|2#plugins} discovered", discoveredPlugins);
    } catch (IOException ex) {
        LOG.log(Level.SEVERE, "Could not discover plug-ins. {0}", ex.getMessage());
        LOG.log(Level.FINEST, "", ex);
    }

    return discoveredPlugins;
}
 
开发者ID:getconverge,项目名称:converge-1.x,代码行数:36,代码来源:PluginManager.java

示例5: 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

示例6: 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

示例7: findAnnotatedClassFiles

import org.scannotation.AnnotationDB; //导入依赖的package包/类
protected List<JarFileAnnotationPlugin> findAnnotatedClassFiles( String annotationClassName ) {
  JarFileCache jarFileCache = JarFileCache.getInstance();
  List<JarFileAnnotationPlugin> classFiles = new ArrayList<>();

  // We want to scan the plugins folder for plugin.xml files...
  //
  for ( PluginFolderInterface pluginFolder : getPluginFolders() ) {

    if ( pluginFolder.isPluginAnnotationsFolder() ) {

      try {
        // Get all the jar files in the plugin folder...
        //
        FileObject[] fileObjects = jarFileCache.getFileObjects( pluginFolder );
        if ( fileObjects != null ) {
          for ( FileObject fileObject : fileObjects ) {

            // These are the jar files : find annotations in it...
            //
            AnnotationDB annotationDB = jarFileCache.getAnnotationDB( fileObject );
            Set<String> impls = annotationDB.getAnnotationIndex().get( annotationClassName );
            if ( impls != null ) {

              for ( String fil : impls ) {
                classFiles.add( new JarFileAnnotationPlugin( fil, fileObject.getURL(), fileObject
                  .getParent().getURL() ) );
              }
            }
          }

        }
      } catch ( Exception e ) {
        e.printStackTrace();
      }
    }
  }
  return classFiles;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:39,代码来源:BasePluginType.java

示例8: 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

示例9: ScannotationDB

import org.scannotation.AnnotationDB; //导入依赖的package包/类
/**
 * Constructor.
 */
public ScannotationDB( )
{
    _db = new AnnotationDB( );
}
 
开发者ID:lutece-platform,项目名称:lutece-core,代码行数:8,代码来源:ScannotationDB.java

示例10: findAnnotatedClassFiles

import org.scannotation.AnnotationDB; //导入依赖的package包/类
protected List<JarFileAnnotationPlugin> findAnnotatedClassFiles(String annotationClassName) {
	
	List<JarFileAnnotationPlugin> classFiles = new ArrayList<JarFileAnnotationPlugin>();
	
	// We want to scan the plugins folder for plugin.xml files...
	//
	for (PluginFolderInterface pluginFolder : getPluginFolders()) {
		
		if (pluginFolder.isPluginAnnotationsFolder()) {
			
			try {
				// Get all the jar files in the plugin folder...
				//
				FileObject[] fileObjects = pluginFolder.findJarFiles();
				if (fileObjects!=null) {
					for (FileObject fileObject : fileObjects) {
						
						// These are the jar files : find annotations in it...
						//
			      AnnotationDB annotationDB = new AnnotationDB();
			      
			      annotationDB.scanArchives(fileObject.getURL());
			      
			      // These are the jar files : find annotations in it...
			      //
			      Set<String> impls = annotationDB.getAnnotationIndex().get(annotationClassName);
			      if(impls != null){
 				      
 				      for(String fil : impls)
 				        classFiles.add(new JarFileAnnotationPlugin(fil, fileObject.getURL(),fileObject.getParent().getURL()));
			      }    
			    }

				}					
			} catch(Exception e) {
			  e.printStackTrace();
			}
		}
	}
	
	return classFiles;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:43,代码来源:BasePluginType.java

示例11: JarFileCache

import org.scannotation.AnnotationDB; //导入依赖的package包/类
private JarFileCache() {
  annotationMap = new HashMap<FileObject, AnnotationDB>();
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:4,代码来源:JarFileCache.java

示例12: addEntry

import org.scannotation.AnnotationDB; //导入依赖的package包/类
public void addEntry(FileObject fileObject, AnnotationDB annotationDb) {
  annotationMap.put(fileObject, annotationDb);
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:4,代码来源:JarFileCache.java

示例13: getEntry

import org.scannotation.AnnotationDB; //导入依赖的package包/类
public AnnotationDB getEntry(FileObject fileObject) {
  return annotationMap.get(fileObject);
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:4,代码来源:JarFileCache.java


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