in commons-digester3-core/src/main/java/org/apache/commons/digester3/BeanPropertySetterRule.java [119:166]
public void end( final String namespace, final String name )
throws Exception
{
String property = propertyName;
if ( property == null )
{
// If we don't have a specific property name,
// use the element name.
property = name;
}
// Get a reference to the top object
final Object top = getDigester().peek();
// log some debugging information
if ( getDigester().getLogger().isDebugEnabled() )
{
getDigester().getLogger().debug( format( "[BeanPropertySetterRule]{%s} Set %s property %s with text %s",
getDigester().getMatch(),
top.getClass().getName(),
property,
bodyText ) );
}
// Force an exception if the property does not exist
// (BeanUtils.setProperty() silently returns in this case)
if ( top instanceof DynaBean )
{
final DynaProperty desc = ( (DynaBean) top ).getDynaClass().getDynaProperty( property );
if ( desc == null )
{
throw new NoSuchMethodException( "Bean has no property named " + property );
}
}
else
/* this is a standard JavaBean */
{
final PropertyDescriptor desc = getPropertyDescriptor( top, property );
if ( desc == null )
{
throw new NoSuchMethodException( "Bean has no property named " + property );
}
}
// Set the property (with conversion as necessary)
setProperty( top, property, bodyText );
}