Object result = null;
final String methodName = method.getName();
final int numArgs = args == null ? 0 : args.length;
if ( numArgs == 0 && JMXUtil.isGetter( method ) )
{
final String name = StringUtil.stripPrefix( methodName, JMXUtil.GET );
result = getValue( name );
if ( result == null && ! containsValue( name ) )
{
throw new NoSuchMethodException( methodName );
}
}
else if ( method.getName().equals( "equals" ) &&
numArgs == 1 )
{
result = new Boolean( equals( args[ 0 ] ) );
}
else if ( numArgs == 0 && method.getName().equals( "toString" ) &&
method.getReturnType() == String.class )
{
result = this.toString();
}
else if ( numArgs == 0 && method.getName().equals( "hashCode" ) &&
method.getReturnType() == int.class )
{
result = new Integer( this.hashCode() );
}
else
{
throw new IllegalArgumentException( methodName );
}
return( result );