in commons-digester3-core/src/main/java/org/apache/commons/digester3/xmlrules/CallMethodRule.java [41:82]
protected void bindRule( final LinkedRuleBuilder linkedRuleBuilder, final Attributes attributes )
throws Exception
{
final CallMethodBuilder builder = linkedRuleBuilder.callMethod( attributes.getValue( "methodname" ) );
// Select which element is to be the target. Default to zero,
// ie the top object on the stack.
final String targetOffsetStr = attributes.getValue( "targetoffset" );
if ( targetOffsetStr != null )
{
int targetOffset = Integer.parseInt( targetOffsetStr );
builder.withTargetOffset( targetOffset );
}
builder.useExactMatch( "true".equalsIgnoreCase( attributes.getValue( "useExactMatch" ) ) );
final String paramCountStr = attributes.getValue( "paramcount" );
if ( paramCountStr != null )
{
final int paramCount = Integer.parseInt( attributes.getValue( "paramcount" ) );
builder.withParamCount( paramCount );
}
final String paramTypesStr = attributes.getValue( "paramtypes" );
if ( paramTypesStr != null && !paramTypesStr.isEmpty() )
{
final StringTokenizer tokens = new StringTokenizer( paramTypesStr, " \t\n\r," );
final String[] paramTypeNames = new String[tokens.countTokens()];
int counter = 0;
while ( tokens.hasMoreTokens() )
{
paramTypeNames[counter++] = tokens.nextToken();
}
builder.withParamTypes( paramTypeNames );
}
if ( "true".equalsIgnoreCase( attributes.getValue( "usingElementBodyAsArgument" ) ) )
{
builder.usingElementBodyAsArgument();
}
}