Class AnnotationWithStrategy<T extends AnnotatorStrategy>

Type Parameters:
T - type of annotation-strategy.
All Implemented Interfaces:
InputFromManager

public class AnnotationWithStrategy<T extends AnnotatorStrategy> extends InputFromManagerDelegate<ProvidesStackInput>
One particular annotation, associated with its strategy.
Author:
Owen Feehan
  • Constructor Details

    • AnnotationWithStrategy

      public AnnotationWithStrategy(ProvidesStackInput input, T strategy) throws OperationFailedException
      Creates for a particular input and associated annotation strategy.
      Parameters:
      input - the input.
      strategy - the strategy.
      Throws:
      OperationFailedException - if a path cannot be determined by strategy for the respective input.
  • Method Details

    • associatedFile

      public Optional<File> associatedFile()
      The file associated with the annotation, if such a file exists.
      Returns:
      the file, if it exists.
    • label

      public Optional<String> label(OperationContext context) throws OperationFailedException
      A human-friendly textual description of the annotation, or Optional.empty() if no label is available.
      Parameters:
      context - context for reading a stack from the file-system.
      Returns:
      the label, if available.
      Throws:
      OperationFailedException - if a label cannot be successfully determined.
    • stacks

      public NamedStacksSupplier stacks(Logger logger)
      All stacks associated with the input, lazily evaluated.

      The stacks are cached the first time they are evaluated, to avoid repeated computation.

      Parameters:
      logger - a logger for any non-fatal errors. Fatal errors throw an exception.
      Returns:
      a supplier of the stacks.
    • getStrategy

      public T getStrategy()
      The strategy on how annotation occurs.
    • getPath

      public Path getPath()
      Path to annotation.