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

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
                      extended by org.apache.commons.jelly.tags.bean.BeanPropertyTag
All Implemented Interfaces:
org.apache.commons.jelly.DynaTag, org.apache.commons.jelly.impl.BeanSource, org.apache.commons.jelly.Tag

public class BeanPropertyTag
extends BeanTag

Creates a nested property via calling a beans createFoo() method then either calling the setFoo(value) or addFoo(value) methods in a similar way to how Ant tags construct themselves.

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

Field Summary
private  java.lang.String createMethodName
          the name of the create method
private static java.lang.Class[] EMPTY_ARG_TYPES
          empty argument types constant
private static java.lang.Object[] EMPTY_ARGS
          empty arguments constant
 
Fields inherited from class org.apache.commons.jelly.tags.bean.BeanTag
addMethodName, EMPTY_ARGUMENTS
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
BeanPropertyTag(java.lang.String tagName)
           
 
Method Summary
protected  java.lang.Class findAddMethodClass(java.lang.Class parentClass)
          finds the parameter type of the first public method in the parent class whose name matches the add{tag name} pattern, whose return type is void and which takes one argument only.
protected  java.lang.reflect.Method findCreateMethod(java.lang.Class theClass)
          Finds the Method to create a new property object
protected  java.lang.Object newInstance(java.lang.Class theClass, java.util.Map attributes, org.apache.commons.jelly.XMLOutput output)
          Creates a new instance by calling a create method on the parent bean
 
Methods inherited from class org.apache.commons.jelly.tags.bean.BeanTag
findAddMethod, getParentObject, getTagName, processBean
 
Methods inherited from class org.apache.commons.jelly.tags.core.UseBeanTag
addIgnoreProperty, convertToClass, doTag, getBean, getDefaultClass, getIgnorePropertySet, isIgnoreUnknownProperties, loadClass, 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

EMPTY_ARGS

private static final java.lang.Object[] EMPTY_ARGS
empty arguments constant


EMPTY_ARG_TYPES

private static final java.lang.Class[] EMPTY_ARG_TYPES
empty argument types constant


createMethodName

private java.lang.String createMethodName
the name of the create method

Constructor Detail

BeanPropertyTag

public BeanPropertyTag(java.lang.String tagName)
Method Detail

newInstance

protected java.lang.Object newInstance(java.lang.Class theClass,
                                       java.util.Map attributes,
                                       org.apache.commons.jelly.XMLOutput output)
                                throws org.apache.commons.jelly.JellyTagException
Creates a new instance by calling a create method on the parent bean

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

findAddMethodClass

protected java.lang.Class findAddMethodClass(java.lang.Class parentClass)
finds the parameter type of the first public method in the parent class whose name matches the add{tag name} pattern, whose return type is void and which takes one argument only.

Parameters:
parentClass -
Returns:
the class of the first and only parameter

findCreateMethod

protected java.lang.reflect.Method findCreateMethod(java.lang.Class theClass)
Finds the Method to create a new property object