}
});
// jcreate instantiates the proxy object which implements all interfaces
// and which is wrapped and implemented by this object
clazz.addMethod("__jcreate!", new JavaMethodN(clazz, Visibility.PRIVATE) {
@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args) {
return jcreateProxy(self, args);
}
});
} else {
// The new "new" actually generates a real Java class to use for the Ruby class's
// backing store, instantiates that, and then calls initialize on it.
addRealImplClassNew(clazz);
}
// Next, we define a few private methods that we'll use to manipulate
// the Java object contained within this Ruby object
// Used by our duck-typification of Proc into interface types, to allow
// coercing a simple proc into an interface parameter.
clazz.addMethod("__jcreate_meta!", new JavaMethodN(clazz, Visibility.PRIVATE) {
@Override
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args) {
IRubyObject result = jcreateProxy(self, args);
return result;