Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.jasper.compiler.tagplugin
Interface 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.

Method Summary
`void` | `dontUseTagPlugin()` Abandon optimization for this tag handler, and instruct Jasper to generate the tag handler calls, as usual.
`void` | `generateAttribute(java.lang.String attribute)` Generate codesto evaluate value of a attribute in the custom tag The codes is a Java expression.
`void` | `generateBody()`
`void` | `generateDeclaration(java.lang.String id, java.lang.String text)` Generate a declaration in the of the generated class.
`void` | `generateImport(java.lang.String s)` Generate an import statement
`void` | `generateJavaSource(java.lang.String s)` Generate Java source codes
`java.lang.String` | `getConstantAttribute(java.lang.String attribute)`
`TagPluginContext` | `getParentContext()` Get the PluginContext for the parent of this custom tag.
`java.lang.Object` | `getPluginAttribute(java.lang.String attr)` Get the value of an attribute in the current tagplugin context.
`java.lang.String` | `getTemporaryVariableName()`
`boolean` | `isAttributeSpecified(java.lang.String attribute)`
`boolean` | `isConstantAttribute(java.lang.String attribute)`
`boolean` | `isScriptless()`
`void` | `setPluginAttribute(java.lang.String attr, java.lang.Object value)` Associate the attribute with a value in the current tagplugin context.

Method Detail

### isScriptless

    public boolean isScriptless()

  Returns:
    true if the body of the tag is scriptless.

### isAttributeSpecified

    public boolean isAttributeSpecified(java.lang.String attribute)

  Parameters:
    `attribute` - Name of the attribute
  Returns:
    true if the attribute is specified in the tag

### getTemporaryVariableName

    public java.lang.String getTemporaryVariableName()

  Returns:
    An unique temporary variable name that the plugin can use.

### generateImport

    public void generateImport(java.lang.String s)

  Generate an import statement

  Parameters:
    `s` - Name of the import class, '*' allowed.

### generateDeclaration

    public void generateDeclaration(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.

  Parameters:
    `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.
    `text` - The text of the declaration.

### generateJavaSource

    public void generateJavaSource(java.lang.String s)

  Generate Java source codes

### isConstantAttribute

    public boolean isConstantAttribute(java.lang.String attribute)

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

### getConstantAttribute

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

  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.

### generateAttribute

    public void generateAttribute(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.

  Parameters:
    `attribute` - The specified attribute

### generateBody

    public void generateBody()

### dontUseTagPlugin

    public void 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 compilicated for optimization.

### getParentContext

    public TagPluginContext 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 pluginConxt if not available (because useTagPlugin is false, e.g).

### setPluginAttribute

    public void setPluginAttribute(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.

### getPluginAttribute

    public java.lang.Object getPluginAttribute(java.lang.String attr)

  Get the value of an attribute in the current tagplugin context.

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000 Apache Software Foundation. All Rights Reserved.