org.apache.commons.jelly.impl
Class TagScript

java.lang.Object
  |
  +--org.apache.commons.jelly.impl.TagScript
All Implemented Interfaces:
Script
Direct Known Subclasses:
BeanTagScript, DynaTagScript

public abstract class TagScript
extends java.lang.Object
implements Script

TagScript abstract base class for a script that evaluates a custom tag.

Version:
$Revision: 1.16 $
Author:
James Strachan

Field Summary
protected  java.util.Map attributes
          The attribute expressions that are created
protected  Tag tag
          the tag to be evaluated
 
Constructor Summary
TagScript()
           
TagScript(Tag tag)
           
 
Method Summary
 void addAttribute(java.lang.String name, Expression expression)
          Add an initialization attribute for the tag.
protected  java.lang.Object convertType(java.lang.Object value, java.lang.Class requiredType)
          Converts the given value to the required type.
protected  JellyException createJellyException(java.lang.String reason)
          Creates a new Jelly exception, adorning it with location information
protected  JellyException createJellyException(java.lang.String reason, java.lang.Exception cause)
          Creates a new Jelly exception, adorning it with location information
protected  void endNamespacePrefixes(XMLOutput output)
          End the new namespace prefixes mapped for the current element
 int getColumnNumber()
           
 java.lang.String getElementName()
           
 java.lang.String getFileName()
           
 int getLineNumber()
           
 Tag getTag()
           
protected  void handleException(java.lang.Exception e)
          A helper method to handle this non-Jelly exception.
protected  void handleException(JellyException e)
          A helper method to handle this Jelly exception.
static TagScript newInstance(Tag tag)
           
 void setColumnNumber(int columnNumber)
          Sets the column number of the tag
 void setElementName(java.lang.String elementName)
          Sets the element name which caused the problem
 void setFileName(java.lang.String fileName)
          Sets the Jelly file which caused the problem
 void setLineNumber(int lineNumber)
          Sets the line number of the tag
 void setLocator(org.xml.sax.Locator locator)
          Configures this TagScript from the SAX Locator, setting the column and line numbers
 void setNamespacesMap(java.util.Map namespacesMap)
          Sets the optional namespaces prefix -> URI map
 void setTag(Tag tag)
          Sets the tag to be evaluated
protected  void startNamespacePrefixes(XMLOutput output)
          Output the new namespace prefixes used for this element
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.commons.jelly.Script
compile, run
 

Field Detail

tag

protected Tag tag
the tag to be evaluated

attributes

protected java.util.Map attributes
The attribute expressions that are created
Constructor Detail

TagScript

public TagScript()

TagScript

public TagScript(Tag tag)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setNamespacesMap

public void setNamespacesMap(java.util.Map namespacesMap)
Sets the optional namespaces prefix -> URI map

setLocator

public void setLocator(org.xml.sax.Locator locator)
Configures this TagScript from the SAX Locator, setting the column and line numbers

newInstance

public static TagScript newInstance(Tag tag)
Returns:
a new TagScript based on whether the tag is a bean tag or DynaTag

addAttribute

public void addAttribute(java.lang.String name,
                         Expression expression)
Add an initialization attribute for the tag. This method must be called after the setTag() method

getTag

public Tag getTag()
Returns:
the tag to be evaluated

setTag

public void setTag(Tag tag)
Sets the tag to be evaluated

getFileName

public java.lang.String getFileName()
Returns:
the Jelly file which caused the problem

setFileName

public void setFileName(java.lang.String fileName)
Sets the Jelly file which caused the problem

getElementName

public java.lang.String getElementName()
Returns:
the element name which caused the problem

setElementName

public void setElementName(java.lang.String elementName)
Sets the element name which caused the problem

getLineNumber

public int getLineNumber()
Returns:
the line number of the tag

setLineNumber

public void setLineNumber(int lineNumber)
Sets the line number of the tag

getColumnNumber

public int getColumnNumber()
Returns:
the column number of the tag

setColumnNumber

public void setColumnNumber(int columnNumber)
Sets the column number of the tag

startNamespacePrefixes

protected void startNamespacePrefixes(XMLOutput output)
                               throws org.xml.sax.SAXException
Output the new namespace prefixes used for this element

endNamespacePrefixes

protected void endNamespacePrefixes(XMLOutput output)
                             throws org.xml.sax.SAXException
End the new namespace prefixes mapped for the current element

convertType

protected java.lang.Object convertType(java.lang.Object value,
                                       java.lang.Class requiredType)
                                throws java.lang.Exception
Converts the given value to the required type.
Parameters:
value - is the value to be converted. This will not be null
requiredType - the type that the value should be converted to

handleException

protected void handleException(java.lang.Exception e)
                        throws java.lang.Exception
A helper method to handle this non-Jelly exception. This method will rethrow the exception, wrapped in a JellyException while adding line number information etc.

createJellyException

protected JellyException createJellyException(java.lang.String reason)
Creates a new Jelly exception, adorning it with location information

createJellyException

protected JellyException createJellyException(java.lang.String reason,
                                              java.lang.Exception cause)
Creates a new Jelly exception, adorning it with location information

handleException

protected void handleException(JellyException e)
                        throws java.lang.Exception
A helper method to handle this Jelly exception. This method adorns the JellyException with location information such as adding line number information etc.


Copyright © 2002-2002 Apache Software Foundation. All Rights Reserved.