net.sf.jelly.apt.strategies
Class IfHasAnnotationStrategy<B extends TemplateBlock>

java.lang.Object
  extended by net.sf.jelly.apt.strategies.TemplateStrategyControl<B>
      extended by net.sf.jelly.apt.strategies.TemplateBlockStrategy<B>
          extended by net.sf.jelly.apt.strategies.IfHasAnnotationStrategy<B>
All Implemented Interfaces:
TemplateStrategy<B>

public class IfHasAnnotationStrategy<B extends TemplateBlock>
extends TemplateBlockStrategy<B>

Evalute the body of the tag if the specified declaration has a given annotation.

Author:
Ryan Heaton

Constructor Summary
IfHasAnnotationStrategy()
           
 
Method Summary
 java.lang.String getAnnotation()
          The annotation to check for.
protected  com.sun.mirror.declaration.Declaration getCurrentDeclaration()
          Gets the current declaration (in a loop).
 com.sun.mirror.declaration.Declaration getDeclaration()
          The declaration on which to evaluate whether exists the annotation.
 java.lang.String getVar()
          The name of the variable to which to assign the annotation.
 boolean preProcess(B block, TemplateOutput<B> output, TemplateModel model)
          Pushes this strategy on the stack and redirects the output.
 void setAnnotation(java.lang.String annotation)
          The annotation to check for.
 void setDeclaration(com.sun.mirror.declaration.Declaration declaration)
          The declaration on which to evaluate whether exists the annotation.
 void setVar(java.lang.String var)
          The name of the variable to which to assign the annotation.
 
Methods inherited from class net.sf.jelly.apt.strategies.TemplateBlockStrategy
postProcess, processBody
 
Methods inherited from class net.sf.jelly.apt.strategies.TemplateStrategyControl
invoke
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IfHasAnnotationStrategy

public IfHasAnnotationStrategy()
Method Detail

preProcess

public boolean preProcess(B block,
                          TemplateOutput<B> output,
                          TemplateModel model)
                   throws java.io.IOException,
                          TemplateException
Description copied from class: TemplateBlockStrategy
Pushes this strategy on the stack and redirects the output.

Overrides:
preProcess in class TemplateBlockStrategy<B extends TemplateBlock>
Parameters:
block - The block.
output - The output.
model - The model.
Returns:
true, as the body should be evaluated.
Throws:
java.io.IOException
TemplateException

getAnnotation

public java.lang.String getAnnotation()
The annotation to check for.

Returns:
The annotation to check for.

setAnnotation

public void setAnnotation(java.lang.String annotation)
The annotation to check for.

Parameters:
annotation - The annotation to check for.

getVar

public java.lang.String getVar()
The name of the variable to which to assign the annotation.

Returns:
The name of the variable to which to assign the annotation.

setVar

public void setVar(java.lang.String var)
The name of the variable to which to assign the annotation.

Parameters:
var - The name of the variable to which to assign the annotation.

getDeclaration

public com.sun.mirror.declaration.Declaration getDeclaration()
The declaration on which to evaluate whether exists the annotation.

Returns:
The declaration on which to evaluate whether exists the annotation.

setDeclaration

public void setDeclaration(com.sun.mirror.declaration.Declaration declaration)
The declaration on which to evaluate whether exists the annotation.

Parameters:
declaration - The declaration on which to evaluate whether exists the annotation.

getCurrentDeclaration

protected com.sun.mirror.declaration.Declaration getCurrentDeclaration()
Gets the current declaration (in a loop).

Returns:
the current declaration (in a loop).