org.specrunner.core.pipes
Class PipeAnnotator

java.lang.Object
  extended by org.specrunner.core.pipes.PipeAnnotator
All Implemented Interfaces:
IPipe

public class PipeAnnotator
extends Object
implements IPipe

Pipe to bind an annotator to the channel.

Author:
Thiago Santos.

Field Summary
static String ANNOTATOR
          Object name into the channel.
 
Constructor Summary
PipeAnnotator()
           
 
Method Summary
static IChannel bind(IChannel channel, IAnnotator obj)
          Bind the object to the channel.
 boolean check(IChannel channel)
          Check if a pipe must perform something on channel.
protected  IAnnotator createAnnotator()
          Creates an annotator instance.
static IAnnotator lookup(IChannel channel)
          Look for the object into the channel.
 IChannel process(IChannel channel)
          Perform some transformation over the channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANNOTATOR

public static final String ANNOTATOR
Object name into the channel.

See Also:
Constant Field Values
Constructor Detail

PipeAnnotator

public PipeAnnotator()
Method Detail

check

public boolean check(IChannel channel)
              throws AbortException
Description copied from interface: IPipe
Check if a pipe must perform something on channel. If the channel is corrupted the pipe must throw AbortException.

Specified by:
check in interface IPipe
Parameters:
channel - The information channel.
Returns:
true, if pipe must perform something on channel, false, otherwise.
Throws:
AbortException - If the channel is corrupted.

process

public IChannel process(IChannel channel)
                 throws PipelineException
Description copied from interface: IPipe
Perform some transformation over the channel.

Specified by:
process in interface IPipe
Parameters:
channel - The channel.
Returns:
The pipe itself.
Throws:
PipelineException - On processing errors.

createAnnotator

protected IAnnotator createAnnotator()
                              throws AnnotatorException
Creates an annotator instance.

Returns:
A annotator.
Throws:
AnnotatorException - On creation error.

bind

public static IChannel bind(IChannel channel,
                            IAnnotator obj)
Bind the object to the channel.

Parameters:
channel - The channel.
obj - The object.
Returns:
The channel itself.

lookup

public static IAnnotator lookup(IChannel channel)
                         throws NotFoundException,
                                InvalidTypeException
Look for the object into the channel.

Parameters:
channel - The channel.
Returns:
The object.
Throws:
NotFoundException - When object with the given name.
InvalidTypeException - When expected type do not match.


Copyright © 2014. All rights reserved.