當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。