net.sf.jelly.apt.strategies
Class DeclarationLoopStrategy<D extends com.sun.mirror.declaration.Declaration,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.TemplateLoopStrategy<D,B>
              extended by net.sf.jelly.apt.strategies.DeclarationLoopStrategy<D,B>
All Implemented Interfaces:
TemplateStrategy<B>
Direct Known Subclasses:
AnnotationFilterableDeclarationLoopStrategy

public abstract class DeclarationLoopStrategy<D extends com.sun.mirror.declaration.Declaration,B extends TemplateBlock>
extends TemplateLoopStrategy<D,B>

Invokes the template body over a set of declarations.

Author:
Ryan Heaton

Constructor Summary
DeclarationLoopStrategy()
           
 
Method Summary
 D getCurrentDeclaration()
          The current declaration in the loop.
abstract  java.util.Collection<D> getDeclarations()
          The declarations to loop through.
 java.lang.String getIndexVar()
          Variable in which to store the value of the index.
protected  java.util.Iterator<D> getLoop(TemplateModel model)
          The loop variable is the collection of declarations over which to loop.
 java.lang.String getVar()
          The context variable in which to store the declaration.
 void setIndexVar(java.lang.String indexVar)
          Variable in which to store the value of the index.
protected  void setupModelForLoop(TemplateModel model, D declaration, int index)
          Sets up the model for the current loop.
 void setVar(java.lang.String var)
          The context variable in which to store the declaration.
 
Methods inherited from class net.sf.jelly.apt.strategies.TemplateLoopStrategy
preProcess, processBody
 
Methods inherited from class net.sf.jelly.apt.strategies.TemplateBlockStrategy
postProcess
 
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

DeclarationLoopStrategy

public DeclarationLoopStrategy()
Method Detail

getLoop

protected java.util.Iterator<D> getLoop(TemplateModel model)
                                                                                throws TemplateException
The loop variable is the collection of declarations over which to loop.

Specified by:
getLoop in class TemplateLoopStrategy<D extends com.sun.mirror.declaration.Declaration,B extends TemplateBlock>
Parameters:
model -
Returns:
The iterator over the collection of declarations.
Throws:
TemplateException

setupModelForLoop

protected void setupModelForLoop(TemplateModel model,
                                 D declaration,
                                 int index)
                          throws TemplateException
Description copied from class: TemplateLoopStrategy
Sets up the model for the current loop. Default implementation does nothing.

Overrides:
setupModelForLoop in class TemplateLoopStrategy<D extends com.sun.mirror.declaration.Declaration,B extends TemplateBlock>
Parameters:
model - The model.
declaration - The loop variable.
index - The loop index.
Throws:
TemplateException

getCurrentDeclaration

public D getCurrentDeclaration()
The current declaration in the loop.

Returns:
The current declaration in the loop.

getDeclarations

public abstract java.util.Collection<D> getDeclarations()
                                                                                                throws MissingParameterException
The declarations to loop through.

Returns:
The declarations to loop through.
Throws:
MissingParameterException

getVar

public java.lang.String getVar()
The context variable in which to store the declaration.

Returns:
The context variable in which to store the declaration.

setVar

public void setVar(java.lang.String var)
The context variable in which to store the declaration.

Parameters:
var - The context variable in which to store the declaration.

getIndexVar

public java.lang.String getIndexVar()
Variable in which to store the value of the index.

Returns:
Variable in which to store the value of the index.

setIndexVar

public void setIndexVar(java.lang.String indexVar)
Variable in which to store the value of the index.

Parameters:
indexVar - Variable in which to store the value of the index.