[jruby-user] CallbackFactory deprecated; what is a contemporary example?

5 views
Skip to first unread message

Chris Kruger

unread,
May 21, 2013, 10:46:00 PM5/21/13
to us...@jruby.codehaus.org
Hello Jruby Folks,

So I am trying to implement some Jruby extensions using the BasicLibraryService class based on this blog entry

http://ola-bini.blogspot.com.au/2006/10/jruby-tutorial-4-writing-java.html

I'm using jruby-1.7.4 and it seem that the callbackFactory method on Ruby object is now setup to throw an exception because the that technique is deprecated.

The documentation talks about using MethodFactories now, instead of the CallbackFactory. However I could not glean from the documentation how this was supposed to work.

The code that does not work looks like below

public boolean basicLoad(final Ruby runtime) throws IOException {
RubyModule string = runtime.getModule("String");
CallbackFactory fact = runtime.callbackFactory(FastXsService.class);
string.defineMethod("fast_xs",fact.getFastSingletonMethod("fast_xs" ));
return true;
}

What's the contemporary equivalent using MethodFactory? Where do I get a MethodFactory instantiated with everything I need?

Thanks in advance for any help!

Chris Kruger





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Reply all
Reply to author
Forward
0 new messages