org.scijava.annotations
Class AbstractIndexWriter

java.lang.Object
  extended by org.scijava.annotations.AbstractIndexWriter
Direct Known Subclasses:
AnnotationCombiner, DirectoryIndexer

public abstract class AbstractIndexWriter
extends Object

Writes annotations as JSON-formatted files.

The file names are the names of the annotations, and the serialized data describe the class which was annotated together with the specific annotation fields.

Author:
Johannes Schindelin

Nested Class Summary
static interface AbstractIndexWriter.StreamFactory
           
 
Constructor Summary
AbstractIndexWriter()
           
 
Method Summary
protected
<A extends Annotation>
Map<String,Object>
adapt(A annotation)
           
protected  Object adapt(Object o)
           
protected  void add(Map<String,Object> annotationValues, String annotationName, String className)
           
protected  boolean foundAnnotations()
           
protected  void merge(String annotationName, AbstractIndexWriter.StreamFactory factory)
          Merges an existing annotation index into the currently-generated one.
protected  void write(AbstractIndexWriter.StreamFactory factory)
           
protected  void writeMap(PrintStream out, Object... pairs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractIndexWriter

public AbstractIndexWriter()
Method Detail

foundAnnotations

protected boolean foundAnnotations()

add

protected void add(Map<String,Object> annotationValues,
                   String annotationName,
                   String className)

write

protected void write(AbstractIndexWriter.StreamFactory factory)
              throws IOException
Throws:
IOException

merge

protected void merge(String annotationName,
                     AbstractIndexWriter.StreamFactory factory)
              throws IOException
Merges an existing annotation index into the currently-generated one.

This method is used to read previously-indexed annotations and reconcile them with the newly-generated ones just.

Parameters:
annotationName - the name of the annotation for which the index contains the annotated classes
factory - the factory to generate input and output streams given an annotation name
Throws:
IOException

adapt

protected Object adapt(Object o)

adapt

protected <A extends Annotation> Map<String,Object> adapt(A annotation)

writeMap

protected void writeMap(PrintStream out,
                        Object... pairs)
                 throws IOException
Throws:
IOException


Copyright © 2009–2014 SciJava. All rights reserved.