Class TagPluginManager.TagPluginContextImpl

java.lang.Object
org.apache.jasper.compiler.TagPluginManager.TagPluginContextImpl
All Implemented Interfaces:
TagPluginContext
Enclosing class:
TagPluginManager

static class TagPluginManager.TagPluginContextImpl extends Object implements TagPluginContext
  • Field Details

  • Constructor Details

  • Method Details

    • getParentContext

      public TagPluginContext getParentContext()
      Description copied from interface: TagPluginContext
      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*().
      Specified by:
      getParentContext in interface TagPluginContext
      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(String key, Object value)
      Description copied from interface: TagPluginContext
      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 invalid input: '<'c:when> for an example.
      Specified by:
      setPluginAttribute in interface TagPluginContext
    • getPluginAttribute

      public Object getPluginAttribute(String key)
      Description copied from interface: TagPluginContext
      Get the value of an attribute in the current tagplugin context.
      Specified by:
      getPluginAttribute in interface TagPluginContext
    • isScriptless

      public boolean isScriptless()
      Specified by:
      isScriptless in interface TagPluginContext
      Returns:
      true if the body of the tag is scriptless.
    • isConstantAttribute

      public boolean isConstantAttribute(String attribute)
      Specified by:
      isConstantAttribute in interface TagPluginContext
      Returns:
      true if the attribute is specified and its value is a translation-time constant.
    • getConstantAttribute

      public String getConstantAttribute(String attribute)
      Specified by:
      getConstantAttribute in interface TagPluginContext
      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.
    • isAttributeSpecified

      public boolean isAttributeSpecified(String attribute)
      Specified by:
      isAttributeSpecified in interface TagPluginContext
      Parameters:
      attribute - Name of the attribute
      Returns:
      true if the attribute is specified in the tag
    • getTemporaryVariableName

      public String getTemporaryVariableName()
      Specified by:
      getTemporaryVariableName in interface TagPluginContext
      Returns:
      An unique temporary variable name that the plugin can use.
    • generateImport

      public void generateImport(String imp)
      Description copied from interface: TagPluginContext
      Generate an import statement
      Specified by:
      generateImport in interface TagPluginContext
      Parameters:
      imp - Name of the import class, '*' allowed.
    • generateDeclaration

      public void generateDeclaration(String id, String text)
      Description copied from interface: TagPluginContext
      Generate a declaration in the of the generated class. This can be used to declare an innter class, a method, or a class variable.
      Specified by:
      generateDeclaration in interface TagPluginContext
      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(String sourceCode)
      Description copied from interface: TagPluginContext
      Generate Java source codes
      Specified by:
      generateJavaSource in interface TagPluginContext
    • generateAttribute

      public void generateAttribute(String attributeName)
      Description copied from interface: TagPluginContext
      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.
      Specified by:
      generateAttribute in interface TagPluginContext
      Parameters:
      attributeName - The specified attribute
    • dontUseTagPlugin

      public void dontUseTagPlugin()
      Description copied from interface: TagPluginContext
      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.
      Specified by:
      dontUseTagPlugin in interface TagPluginContext
    • generateBody

      public void generateBody()
      Specified by:
      generateBody in interface TagPluginContext
    • getNodeAttribute

      private Node.JspAttribute getNodeAttribute(String attribute)