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

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

public class AnnotationValueStrategy<B extends TemplateBlock>
extends TemplateValueStrategy<B>

Outputs an annotation value. If a declaration is specified, it will be used to lookup the annotation value. Otherwise, this tag must be nested within a declaration loop tag and the current declaration will be used. If a default value is specified, it will be output if either (1) the specified annotation doesn't exist, (2) the specified annotation element doesn't exist, or (3) the value of the specified annotation element is its default value. If no default value is specified, the declared default value of the element will be output (if there is one). Otherwise, nothing will be output.

Author:
Ryan Heaton

Constructor Summary
AnnotationValueStrategy()
           
 
Method Summary
 java.lang.String getAnnotation()
          The specified annotation.
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 get the annotation value.
 java.lang.String getDefault()
          The default value to output under any of the following circumstances:

the annotation wasn't found the specified type element wasn't found the value of the specified type element was its default value.

 java.lang.String getElement()
          The type element.
protected  java.lang.String getValue()
          Get the value to write to the template output.
 void setAnnotation(java.lang.String annotation)
          The specified annotation.
 void setDeclaration(com.sun.mirror.declaration.Declaration declaration)
          The declaration on which to get the annotation value.
 void setDefault(java.lang.String defaultValue)
          The default to return under any of the following circumstances:

the annotation wasn't found the specified type element wasn't found the value of the specified type element was its default value.

 void setElement(java.lang.String element)
          The type element.
 
Methods inherited from class net.sf.jelly.apt.strategies.TemplateValueStrategy
postProcess, preProcess, 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

AnnotationValueStrategy

public AnnotationValueStrategy()
Method Detail

getValue

protected java.lang.String getValue()
                             throws TemplateException
Description copied from class: TemplateValueStrategy
Get the value to write to the template output.

Specified by:
getValue in class TemplateValueStrategy<B extends TemplateBlock>
Returns:
The value to write to the template output.
Throws:
TemplateException

getCurrentDeclaration

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

Returns:
the current declaration (in a loop).

getDeclaration

public com.sun.mirror.declaration.Declaration getDeclaration()
The declaration on which to get the annotation value.

Returns:
The declaration on which to get the annotation value.

setDeclaration

public void setDeclaration(com.sun.mirror.declaration.Declaration declaration)
The declaration on which to get the annotation value.

Parameters:
declaration - The declaration on which to get the annotation value.

getDefault

public java.lang.String getDefault()
The default value to output under any of the following circumstances:

Returns:
The default value to output.

setDefault

public void setDefault(java.lang.String defaultValue)
The default to return under any of the following circumstances:

Parameters:
defaultValue - The default value.

getAnnotation

public java.lang.String getAnnotation()
The specified annotation.

Returns:
The specified annotation.

setAnnotation

public void setAnnotation(java.lang.String annotation)
The specified annotation.

Parameters:
annotation - The specified annotation.

getElement

public java.lang.String getElement()
The type element. Default is "value".

Returns:
The type element. Default is "value".

setElement

public void setElement(java.lang.String element)
The type element. Default is "value".

Parameters:
element - The type element. Default is "value".