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


Java Index类代码示例

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


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

示例1: buildElementReaderIndex

import org.scijava.annotations.Index; //导入依赖的package包/类
/** Set-up the {@link ElementReader} index */
private void buildElementReaderIndex() {
    elementReaderIndex = new ArrayList<ReaderRecord>();
    for(IndexItem<ElementReaderMetadata> item :
            Index.load(ElementReaderMetadata.class, getClass().getClassLoader())) {
        ElementReaderMetadata a = item.annotation();
        try {
            ReaderRecord r = new ReaderRecord(
                    item.className(),
                    a.name(),
                    a.processedType(),
                    a.elementType(),
                    a.mimeTypes(),
                    a.hidden());
            elementReaderIndex.add(r);
        } catch(ClassNotFoundException e) {
            throw new IllegalArgumentException(e);
        }
    }
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:21,代码来源:DataTypeIDService.java

示例2: buildElementWriterIndex

import org.scijava.annotations.Index; //导入依赖的package包/类
/** Set-up the {@link ElementWriter} index */
private void buildElementWriterIndex() {
    elementWriterIndex = new ArrayList<WriterRecord>();
    for(IndexItem<ElementWriterMetadata> item :
            Index.load(ElementWriterMetadata.class, getClass().getClassLoader())) {
        ElementWriterMetadata a = item.annotation();
        try {
            WriterRecord r = new WriterRecord(
                    item.className(),
                    a.name(),
                    a.processedType(),
                    a.elementType(),
                    a.mimeType(),
                    a.linkExt());
            if(r.mimeType.equals("null"))
                r.mimeType = null;
            if(r.linkExt.equals("null"))
                r.linkExt = null;
            elementWriterIndex.add(r);
        } catch(ClassNotFoundException e) {
            throw new IllegalArgumentException(e);
        }
    }
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:25,代码来源:DataTypeIDService.java

示例3: buildTypeAliasIndex

import org.scijava.annotations.Index; //导入依赖的package包/类
/** Set-up the {@link TypeAlias} index */
private void buildTypeAliasIndex() {
    typeAliasIndex = new
            LinkedHashMap<Class<?>, Class<? extends TypeAlias>>();
    for(IndexItem<TypeAliasMetadata> item :
            Index.load(TypeAliasMetadata.class, getClass().getClassLoader())) {
        try {
            TypeAlias ta = (TypeAlias) Class.forName(
                    item.className()).newInstance();
            typeAliasIndex.put(
                    ta.getRealType(),
                    ta.getClass());
        } catch (Exception e) {
            throw new IllegalStateException(
                    "Couldn't load type aliases: ", e);
        }
    }
}
 
开发者ID:bnanes,项目名称:slideset,代码行数:19,代码来源:DataTypeIDService.java

示例4: build

import org.scijava.annotations.Index; //导入依赖的package包/类
private static void build()
{
	buildWasCalled = true;
	try
	{
		final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
		final Index< ViewSetupAttributeIo > annotationIndex = Index.load( ViewSetupAttributeIo.class, classLoader );
		for ( final IndexItem< ViewSetupAttributeIo > item : annotationIndex )
		{
			name_to_XmlIoClassName.put( item.annotation().name(), item.className() );
			attributeClass_to_name.put( item.annotation().type(), item.annotation().name() );
		}
	}
	catch( final Exception e )
	{
		throw new RuntimeException( "problem accessing annotation index", e );
	}
}
 
开发者ID:bigdataviewer,项目名称:spimdata,代码行数:19,代码来源:ViewSetupAttributes.java

示例5: build

import org.scijava.annotations.Index; //导入依赖的package包/类
private static void build()
{
	buildWasCalled = true;
	try
	{
		final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
		final Index< ImgLoaderIo > annotationIndex = Index.load( ImgLoaderIo.class, classLoader );
		for ( final IndexItem< ImgLoaderIo > item : annotationIndex )
		{
			format_to_XmlIoClassName.put( item.annotation().format(), item.className() );
			imgLoaderClass_to_XmlIoClassName.put( item.annotation().type(), item.className() );
		}
	}
	catch( final Exception e )
	{
		throw new RuntimeException( "problem accessing annotation index", e );
	}
}
 
开发者ID:bigdataviewer,项目名称:spimdata,代码行数:19,代码来源:ImgLoaders.java

示例6: update

import org.scijava.annotations.Index; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void update() {

	compressionParameters.clear();

	final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
	final Index<CompressionType> annotationIndex = Index.load(CompressionType.class, classLoader);
	for (final IndexItem<CompressionType> item : annotationIndex) {
		Class<? extends Compression> clazz;
		try {
			clazz = (Class<? extends Compression>)Class.forName(item.className());
			final String type = clazz.getAnnotation(CompressionType.class).value();

			Constructor<? extends Compression> constructor = clazz.getDeclaredConstructor();

			final HashMap<String, Class<?>> parameters = new HashMap<>();
			ArrayList<Field> fields = getDeclaredFields(clazz);
			for (final Field field : fields) {
				if (field.getAnnotation(CompressionParameter.class) != null) {
					parameters.put(field.getName(), field.getType());
				}
			}

			compressionConstructors.put(type, constructor);
			compressionParameters.put(type, parameters);
		} catch (final ClassNotFoundException | NoSuchMethodException | ClassCastException e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:saalfeldlab,项目名称:n5,代码行数:31,代码来源:CompressionAdapter.java


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