Interface TagPluginContext
public interface TagPluginContext
This interface allows the plugin author to make inquiries about the
 properties of the current tag, and to use Jasper resources to generate
 direct Java codes in place of tag handler invocations.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAbandon optimization for this tag handler, and instruct Jasper to generate the tag handler calls, as usual.voidgenerateAttribute(String attribute) Generate codes to evaluate value of a attribute in the custom tag The codes is a Java expression.voidGenerate codes for the body of the custom tagvoidgenerateDeclaration(String id, String text) Generate a declaration in the of the generated class.voidGenerate an import statementvoidGenerate Java source code scriptletgetConstantAttribute(String attribute) Get the PluginContext for the parent of this custom tag.getPluginAttribute(String attr) Get the value of an attribute in the current tagplugin context.booleanisAttributeSpecified(String attribute) booleanisConstantAttribute(String attribute) booleanbooleanIs the tag being used inside a tag file?voidsetPluginAttribute(String attr, Object value) Associate the attribute with a value in the current tagplugin context.
- 
Method Details- 
isScriptlessboolean isScriptless()- Returns:
- true if the body of the tag is scriptless.
 
- 
isAttributeSpecified- Parameters:
- attribute- Name of the attribute
- Returns:
- true if the attribute is specified in the tag
 
- 
getTemporaryVariableNameString getTemporaryVariableName()- Returns:
- A unique temporary variable name that the plugin can use.
 
- 
generateImportGenerate an import statement- Parameters:
- s- Name of the import class, '*' allowed.
 
- 
generateDeclarationGenerate a declaration in the of the generated class. This can be used to declare an inner class, a method, or a class variable.- Parameters:
- id- A unique ID identifying the declaration. It is not part of the declaration, and is used to ensure that the declaration will only appear once. If this method is invoked with the same id more than once in the translation unit, only the first declaration will be taken.
- text- The text of the declaration.
 
- 
generateJavaSourceGenerate Java source code scriptlet- Parameters:
- s- the scriptlet (raw Java source)
 
- 
isConstantAttribute- Parameters:
- attribute- The attribute name
- Returns:
- true if the attribute is specified and its value is a translation-time constant.
 
- 
getConstantAttribute- Parameters:
- attribute- The attribute name
- Returns:
- A string that is the value of a constant attribute. Undefined if the attribute is not a (translation-time) constant. null if the attribute is not specified.
 
- 
generateAttributeGenerate codes to evaluate value of a attribute in the custom tag The codes is a Java expression. NOTE: Currently cannot handle attributes that are fragments.- Parameters:
- attribute- The specified attribute
 
- 
generateBodyvoid generateBody()Generate codes for the body of the custom tag
- 
dontUseTagPluginvoid dontUseTagPlugin()Abandon optimization for this tag handler, and instruct Jasper to generate the tag handler calls, as usual. Should be invoked if errors are detected, or when the tag body is deemed too complicated for optimization.
- 
getParentContextTagPluginContext getParentContext()Get the PluginContext for the parent of this custom tag. NOTE: The operations available for PluginContext so obtained is limited to getPluginAttribute and setPluginAttribute, and queries (e.g. isScriptless(). There should be no calls to generate*().- Returns:
- The pluginContext for the parent node. null if the parent is not a custom tag, or if the pluginContext if not available (because useTagPlugin is false, e.g).
 
- 
setPluginAttributeAssociate the attribute with a value in the current tagplugin context. The plugin attributes can be used for communication among tags that must work together as a group. See <c:when> for an example.- Parameters:
- attr- The attribute name
- value- The attribute value
 
- 
getPluginAttributeGet the value of an attribute in the current tagplugin context.- Parameters:
- attr- The attribute name
- Returns:
- the attribute value
 
- 
isTagFileboolean isTagFile()Is the tag being used inside a tag file?- Returns:
- trueif inside a tag file
 
 
-