本文整理了Java中org.jruby.RubyModule.setMethodVisibility
方法的一些代码示例,展示了RubyModule.setMethodVisibility
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.setMethodVisibility
方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:setMethodVisibility
[英]set_method_visibility
[中]设置方法可见性
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private void setVisibility(ThreadContext context, IRubyObject[] args, Visibility visibility) {
if (args.length == 0) {
// Note: we change current frames visibility here because the methods which call
// this method are all "fast" (e.g. they do not created their own frame).
context.setCurrentVisibility(visibility);
} else {
setMethodVisibility(args, visibility);
}
}
代码示例来源:origin: org.jruby/jruby-complete
private void setVisibility(ThreadContext context, IRubyObject[] args, Visibility visibility) {
if (args.length == 0) {
// Note: we change current frames visibility here because the methods which call
// this method are all "fast" (e.g. they do not created their own frame).
context.setCurrentVisibility(visibility);
} else {
setMethodVisibility(args, visibility);
}
}
代码示例来源:origin: org.jruby/jruby-core
private void setVisibility(ThreadContext context, IRubyObject[] args, Visibility visibility) {
if (args.length == 0) {
// Note: we change current frames visibility here because the methods which call
// this method are all "fast" (e.g. they do not created their own frame).
context.setCurrentVisibility(visibility);
} else {
setMethodVisibility(args, visibility);
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private void setVisibility(ThreadContext context, IRubyObject[] args, Visibility visibility) {
if (args.length == 0) {
// Note: we change current frames visibility here because the methods which call
// this method are all "fast" (e.g. they do not created their own frame).
context.setCurrentVisibility(visibility);
} else {
setMethodVisibility(args, visibility);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/** rb_mod_modfunc
*
*/
@JRubyMethod(name = "module_function", rest = true, visibility = PRIVATE, writes = VISIBILITY)
public RubyModule module_function(ThreadContext context, IRubyObject[] args) {
Ruby runtime = context.runtime;
if (args.length == 0) {
context.setCurrentVisibility(MODULE_FUNCTION);
} else {
setMethodVisibility(args, PRIVATE);
for (int i = 0; i < args.length; i++) {
String name = args[i].asJavaString().intern();
DynamicMethod method = deepMethodSearch(name, runtime);
getSingletonClass().addMethod(name, new WrapperMethod(getSingletonClass(), method, PUBLIC));
callMethod(context, "singleton_method_added", context.runtime.fastNewSymbol(name));
}
}
return this;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/** rb_mod_modfunc
*
*/
@JRubyMethod(name = "module_function", rest = true, visibility = PRIVATE, writes = VISIBILITY)
public RubyModule module_function(ThreadContext context, IRubyObject[] args) {
Ruby runtime = context.runtime;
if (args.length == 0) {
context.setCurrentVisibility(MODULE_FUNCTION);
} else {
setMethodVisibility(args, PRIVATE);
for (int i = 0; i < args.length; i++) {
String name = args[i].asJavaString().intern();
DynamicMethod method = deepMethodSearch(name, runtime);
getSingletonClass().addMethod(name, new WrapperMethod(getSingletonClass(), method, PUBLIC));
callMethod(context, "singleton_method_added", context.runtime.fastNewSymbol(name));
}
}
return this;
}
代码示例来源:origin: org.jruby/jruby-core
/** rb_mod_modfunc
*
*/
@JRubyMethod(name = "module_function", rest = true, visibility = PRIVATE, writes = VISIBILITY)
public RubyModule module_function(ThreadContext context, IRubyObject[] args) {
Ruby runtime = context.runtime;
if (!isModule()) {
throw context.runtime.newTypeError("module_function must be called for modules");
}
if (args.length == 0) {
context.setCurrentVisibility(MODULE_FUNCTION);
} else {
setMethodVisibility(args, PRIVATE);
for (int i = 0; i < args.length; i++) {
RubySymbol name = TypeConverter.checkID(args[i]);
DynamicMethod method = deepMethodSearch(name.idString(), runtime);
DynamicMethod newMethod = method.dup();
newMethod.setImplementationClass(getSingletonClass());
newMethod.setVisibility(PUBLIC);
getSingletonClass().addMethod(name.idString(), newMethod);
callMethod(context, "singleton_method_added", name);
}
}
return this;
}
代码示例来源:origin: org.jruby/jruby-complete
/** rb_mod_modfunc
*
*/
@JRubyMethod(name = "module_function", rest = true, visibility = PRIVATE, writes = VISIBILITY)
public RubyModule module_function(ThreadContext context, IRubyObject[] args) {
Ruby runtime = context.runtime;
if (!isModule()) {
throw context.runtime.newTypeError("module_function must be called for modules");
}
if (args.length == 0) {
context.setCurrentVisibility(MODULE_FUNCTION);
} else {
setMethodVisibility(args, PRIVATE);
for (int i = 0; i < args.length; i++) {
RubySymbol name = TypeConverter.checkID(args[i]);
DynamicMethod method = deepMethodSearch(name.idString(), runtime);
DynamicMethod newMethod = method.dup();
newMethod.setImplementationClass(getSingletonClass());
newMethod.setVisibility(PUBLIC);
getSingletonClass().addMethod(name.idString(), newMethod);
callMethod(context, "singleton_method_added", name);
}
}
return this;
}
内容来源于网络,如有侵权,请联系作者删除!