in core/src/main/java/org/apache/commons/jelly/impl/DynamicBeanTag.java [107:170]
public void doTag(XMLOutput output) throws JellyTagException {
// lets find any attributes that are not set and
for ( Iterator iter = attributes.values().iterator(); iter.hasNext(); ) {
Attribute attribute = (Attribute) iter.next();
String name = attribute.getName();
if ( ! setAttributesSet.contains( name ) ) {
if ( attribute.isRequired() ) {
throw new MissingAttributeException(name);
}
// lets get the default value
Object value = null;
Expression expression = attribute.getDefaultValue();
if ( expression != null ) {
value = expression.evaluate(context);
}
// only set non-null values?
if ( value != null ) {
super.setAttribute(name, value);
}
}
}
// If the dynamic bean is itself a tag, let it execute itself
if (bean instanceof Tag)
{
Tag tag = (Tag) bean;
tag.setBody(getBody());
tag.setContext(getContext());
tag.setParent(getParent());
((Tag) bean).doTag(output);
return;
}
invokeBody(output);
// export the bean if required
if ( var != null ) {
context.setVariable(var, bean);
}
// now, I may invoke the 'execute' method if I have one
if ( method != null ) {
try {
method.invoke( bean, emptyArgs );
}
catch (IllegalAccessException e) {
methodInvocationException(bean, method, e);
}
catch (IllegalArgumentException e) {
methodInvocationException(bean, method, e);
}
catch (InvocationTargetException e) {
// methodInvocationError(bean, method, e);
Throwable inner = e.getTargetException();
throw new JellyTagException(inner);
}
}
}