Top Description Methods
org.jruby.runtime.profile

public Interface MethodEnhancer

Known Direct Implementers
org.jruby.runtime.profile.builtin.BuiltinProfilingService.DefaultMethodEnhancer
Imports
org.jruby.internal.runtime.methods.DynamicMethod

Implementations of this interface will be used to enhance methods with profiling information/ callbacks. TODO This can be moved, I think it's also useful outside the profile package.
Author
Andre Kullmann

Method Summary

Modifier and TypeMethod and Description
public DynamicMethod

Returns:

the enhanced method. if nothing is to be done, the delegate itself can be returned
enhance
(String
the name of the given delegate
id
,
DynamicMethod
the method to enhance
delegate
)

Will be called with a method which should be enhanced.

Method Detail

enhanceback to summary
public DynamicMethod enhance(String id, DynamicMethod delegate)

Will be called with a method which should be enhanced. e.g. with information or callback invocations required by the profiling. In most cases you don't want to profile all methods, just the methods of your own code. So you can add a simple filter here

if( isMyCode( delegate ) ) {
    return new ProfilingDynamicMethod( delegate );
} else {
    return delegate;
}
Parameters
id:String

the name of the given delegate

delegate:DynamicMethod

the method to enhance

Returns:DynamicMethod

the enhanced method. if nothing is to be done, the delegate itself can be returned