FileDocCategorySizeDatePackage
TagPluginContext.javaAPI DocApache Tomcat 6.0.144580Fri Jul 20 04:20:34 BST 2007org.apache.jasper.compiler.tagplugin

TagPluginContext

public interface TagPluginContext
This interface allows the plugin author to make inqueries about the properties of the current tag, and to use Jasper resources to generate direct Java codes in place of tag handler invocations.

Fields Summary
Constructors Summary
Methods Summary
public voiddontUseTagPlugin()
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 compilicated for optimization.

public voidgenerateAttribute(java.lang.String attribute)
Generate codesto evaluate value of a attribute in the custom tag The codes is a Java expression. NOTE: Currently cannot handle attributes that are fragments.

param
attribute The specified attribute

public voidgenerateBody()
Generate codes for the body of the custom tag

public voidgenerateDeclaration(java.lang.String id, java.lang.String text)
Generate a declaration in the of the generated class. This can be used to declare an innter class, a method, or a class variable.

param
id An 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.
param
text The text of the declaration.

public voidgenerateImport(java.lang.String s)
Generate an import statement

param
s Name of the import class, '*' allowed.

public voidgenerateJavaSource(java.lang.String s)
Generate Java source codes

public java.lang.StringgetConstantAttribute(java.lang.String attribute)

return
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.

public org.apache.jasper.compiler.tagplugin.TagPluginContextgetParentContext()
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*().

return
The pluginContext for the parent node. null if the parent is not a custom tag, or if the pluginConxt if not available (because useTagPlugin is false, e.g).

public java.lang.ObjectgetPluginAttribute(java.lang.String attr)
Get the value of an attribute in the current tagplugin context.

public java.lang.StringgetTemporaryVariableName()

return
An unique temporary variable name that the plugin can use.

public booleanisAttributeSpecified(java.lang.String attribute)

param
attribute Name of the attribute
return
true if the attribute is specified in the tag

public booleanisConstantAttribute(java.lang.String attribute)

return
true if the attribute is specified and its value is a translation-time constant.

public booleanisScriptless()

return
true if the body of the tag is scriptless.

public voidsetPluginAttribute(java.lang.String attr, java.lang.Object value)
Associate 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 for an example.