net.sf.jelly.apt.strategies
Class AnnotationFilterableDeclarationLoopStrategy<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>
                  extended by net.sf.jelly.apt.strategies.AnnotationFilterableDeclarationLoopStrategy<D,B>
All Implemented Interfaces:
TemplateStrategy<B>
Direct Known Subclasses:
MemberDeclarationLoopStrategy, PackageDeclarationLoopStrategy, ParameterDeclarationLoopStrategy, TypeDeclarationLoopStrategy

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

A declaration loop that is filterable by an annotation class.

Author:
Ryan Heaton

Constructor Summary
AnnotationFilterableDeclarationLoopStrategy()
           
 
Method Summary
abstract  java.util.Collection<D> getAllDeclarationsToConsiderForAnnotationFiltering()
          Get the list of all declarations to consider.
 java.lang.String getAnnotation()
          Optional annotation by which to filter the classes.
 java.lang.String getAnnotationVar()
          The context variable in which to store the annotation, if specified.
 java.util.Collection<D> getDeclarations()
          The filtered list of declarations.
 java.lang.String getExcludes()
          Comma-separated list of annotations that will exclude the declaration from the loop.
protected  boolean hasAnnotation(D declaration, java.lang.String annotationName)
          Whether the given declaration is annotated with an annotation that has the given (fully-qualified) annotation name.
 void setAnnotation(java.lang.String annotation)
          Optional annotation by which to filter the classes.
 void setAnnotationVar(java.lang.String annotationVar)
          The context variable in which to store the annotation, if specified.
 void setExcludes(java.lang.String excludes)
          Comma-separated list of annotations that will exclude the declaration from the loop.
protected  void setupModelForLoop(TemplateModel model, D declaration, int index)
          Sets up the model for the current loop.
 
Methods inherited from class net.sf.jelly.apt.strategies.DeclarationLoopStrategy
getCurrentDeclaration, getIndexVar, getLoop, getVar, setIndexVar, setVar
 
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

AnnotationFilterableDeclarationLoopStrategy

public AnnotationFilterableDeclarationLoopStrategy()
Method Detail

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 DeclarationLoopStrategy<D extends com.sun.mirror.declaration.Declaration,B extends TemplateBlock>
Parameters:
model - The model.
declaration - The loop variable.
index - The loop index.
Throws:
TemplateException

getAllDeclarationsToConsiderForAnnotationFiltering

public abstract java.util.Collection<D> getAllDeclarationsToConsiderForAnnotationFiltering()
                                                                                                                                   throws MissingParameterException
Get the list of all declarations to consider.

Returns:
The list of all declarations to consider.
Throws:
MissingParameterException

getDeclarations

public java.util.Collection<D> getDeclarations()
                                                                                       throws MissingParameterException
The filtered list of declarations.

Specified by:
getDeclarations in class DeclarationLoopStrategy<D extends com.sun.mirror.declaration.Declaration,B extends TemplateBlock>
Returns:
The filtered list of declarations.
Throws:
MissingParameterException

hasAnnotation

protected boolean hasAnnotation(D declaration,
                                java.lang.String annotationName)
Whether the given declaration is annotated with an annotation that has the given (fully-qualified) annotation name.

Parameters:
declaration - The declaration.
annotationName - The annotation name.
Returns:
Whether the declaration has the annotation.

getAnnotation

public java.lang.String getAnnotation()
Optional annotation by which to filter the classes.

Returns:
Optional annotation by which to filter the classes.

setAnnotation

public void setAnnotation(java.lang.String annotation)
Optional annotation by which to filter the classes.

Parameters:
annotation - Optional annotation by which to filter the classes.

getAnnotationVar

public java.lang.String getAnnotationVar()
The context variable in which to store the annotation, if specified.

Returns:
The context variable in which to store the annotation, if specified.

setAnnotationVar

public void setAnnotationVar(java.lang.String annotationVar)
The context variable in which to store the annotation, if specified.

Parameters:
annotationVar - The context variable in which to store the annotation, if specified.

getExcludes

public java.lang.String getExcludes()
Comma-separated list of annotations that will exclude the declaration from the loop.

Returns:
Comma-separated list of annotations that will exclude the declaration from the loop.

setExcludes

public void setExcludes(java.lang.String excludes)
Comma-separated list of annotations that will exclude the declaration from the loop.

Parameters:
excludes - Comma-separated list of annotations that will exclude the declaration from the loop.