org.apache.commons.jelly.tags.bean
Class BeanTag

java.lang.Object
  extended by org.apache.commons.jelly.TagSupport
      extended by org.apache.commons.jelly.DynaTagSupport
          extended by org.apache.commons.jelly.MapTagSupport
              extended by org.apache.commons.jelly.tags.core.UseBeanTag
                  extended by org.apache.commons.jelly.tags.bean.BeanTag
All Implemented Interfaces:
org.apache.commons.jelly.DynaTag, org.apache.commons.jelly.impl.BeanSource, org.apache.commons.jelly.Tag
Direct Known Subclasses:
BeanPropertyTag

public class BeanTag
extends org.apache.commons.jelly.tags.core.UseBeanTag

Creates a bean for the given tag which is then either output as a variable or can be added to a parent tag.

Version:
$Revision: 155420 $
Author:
James Strachan, Christian Sell

Field Summary
protected  java.lang.String addMethodName
          the name of the adder method
protected static java.lang.Object[] EMPTY_ARGUMENTS
           
private  java.lang.reflect.Method invokeMethod
          if present this is used to call a doit method when the bean is constructed
private static org.apache.commons.logging.Log log
          The Log to which logging calls will be made.
private  java.lang.String tagName
          the name of the property to create
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
BeanTag()
           
BeanTag(java.lang.Class defaultClass, java.lang.String tagName)
           
BeanTag(java.lang.Class defaultClass, java.lang.String tagName, java.lang.reflect.Method invokeMethod)
           
 
Method Summary
protected  java.lang.reflect.Method findAddMethod(java.lang.Class beanClass, java.lang.Class valueClass)
          Finds the Method to add the new bean
protected  java.lang.Object getParentObject()
           
 java.lang.String getTagName()
           
protected  void processBean(java.lang.String var, java.lang.Object bean)
          Output the tag as a named variable.
 
Methods inherited from class org.apache.commons.jelly.tags.core.UseBeanTag
addIgnoreProperty, convertToClass, doTag, getBean, getDefaultClass, getIgnorePropertySet, isIgnoreUnknownProperties, loadClass, newInstance, setBean, setBeanProperties, setIgnoreUnknownProperties, validateBeanProperties
 
Methods inherited from class org.apache.commons.jelly.MapTagSupport
createAttributes, getAttributes, setAttribute
 
Methods inherited from class org.apache.commons.jelly.DynaTagSupport
getAttributeType
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.jelly.Tag
getBody, getContext, getParent, invokeBody, setBody, setContext, setParent
 

Field Detail

log

private static final org.apache.commons.logging.Log log
The Log to which logging calls will be made.


EMPTY_ARGUMENTS

protected static final java.lang.Object[] EMPTY_ARGUMENTS

tagName

private java.lang.String tagName
the name of the property to create


addMethodName

protected java.lang.String addMethodName
the name of the adder method


invokeMethod

private java.lang.reflect.Method invokeMethod
if present this is used to call a doit method when the bean is constructed

Constructor Detail

BeanTag

public BeanTag()

BeanTag

public BeanTag(java.lang.Class defaultClass,
               java.lang.String tagName)

BeanTag

public BeanTag(java.lang.Class defaultClass,
               java.lang.String tagName,
               java.lang.reflect.Method invokeMethod)
Method Detail

getTagName

public java.lang.String getTagName()
Returns:
the local name of the XML tag to which this tag is bound

processBean

protected void processBean(java.lang.String var,
                           java.lang.Object bean)
                    throws org.apache.commons.jelly.JellyTagException
Output the tag as a named variable. If the parent bean has an adder or setter method then invoke that to register this bean with its parent.

Overrides:
processBean in class org.apache.commons.jelly.tags.core.UseBeanTag
Throws:
org.apache.commons.jelly.JellyTagException

findAddMethod

protected java.lang.reflect.Method findAddMethod(java.lang.Class beanClass,
                                                 java.lang.Class valueClass)
Finds the Method to add the new bean


getParentObject

protected java.lang.Object getParentObject()
                                    throws org.apache.commons.jelly.JellyTagException
Returns:
the parent bean object
Throws:
org.apache.commons.jelly.JellyTagException