本文整理了Java中org.jruby.RubyModule.removeAutoload
方法的一些代码示例,展示了RubyModule.removeAutoload
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.removeAutoload
方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:removeAutoload
[英]Removes an Autoload object from autoloadMap. ConstantMap must be updated before calling this.
[中]从AutolodMap中删除自动加载的对象。调用此之前必须更新ConstantMap。
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
*/
protected IRubyObject finishAutoload(String name) {
Autoload autoload = getAutoloadMap().get(name);
if (autoload != null) {
IRubyObject value = autoload.getValue();
if (value != null) {
storeConstant(name, value);
}
removeAutoload(name);
return value;
}
return null;
}
代码示例来源:origin: org.jruby/jruby-core
/**
* Set an Object as a defined constant in autoloading.
*/
private boolean setAutoloadConstant(String name, IRubyObject value) {
final Autoload autoload = getAutoloadMap().get(name);
if ( autoload != null ) {
boolean set = autoload.setConstant(getRuntime().getCurrentContext(), value);
if ( ! set ) removeAutoload(name);
return set;
}
return false;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
*/
protected IRubyObject finishAutoload(String name) {
Autoload autoload = getAutoloadMap().get(name);
if (autoload != null) {
IRubyObject value = autoload.getValue();
if (value != null) {
storeConstant(name, value);
}
removeAutoload(name);
return value;
}
return null;
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
*/
protected final IRubyObject finishAutoload(String name) {
final Autoload autoload = getAutoloadMap().get(name);
if ( autoload == null ) return null;
final IRubyObject value = autoload.getValue();
if ( value != null ) {
storeConstant(name, value);
}
removeAutoload(name);
invalidateConstantCache(name);
return value;
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* Set an Object as a defined constant in autoloading.
*/
private boolean setAutoloadConstant(String name, IRubyObject value) {
final Autoload autoload = getAutoloadMap().get(name);
if ( autoload != null ) {
boolean set = autoload.setConstant(getRuntime().getCurrentContext(), value);
if ( ! set ) removeAutoload(name);
return set;
}
return false;
}
代码示例来源:origin: org.jruby/jruby-core
/**
* Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
*/
protected final IRubyObject finishAutoload(String name) {
final Autoload autoload = getAutoloadMap().get(name);
if ( autoload == null ) return null;
final IRubyObject value = autoload.getValue();
if ( value != null ) {
storeConstant(name, value);
}
removeAutoload(name);
invalidateConstantCache(name);
return value;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Set an Object as a defined constant in autoloading.
*/
private void setAutoloadConstant(String name, IRubyObject value) {
Autoload autoload = getAutoloadMap().get(name);
if (autoload != null) {
if (!autoload.setConstant(getRuntime().getCurrentContext(), value)) {
storeConstant(name, value);
removeAutoload(name);
}
} else {
storeConstant(name, value);
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Set an Object as a defined constant in autoloading.
*/
private void setAutoloadConstant(String name, IRubyObject value) {
Autoload autoload = getAutoloadMap().get(name);
if (autoload != null) {
if (!autoload.setConstant(getRuntime().getCurrentContext(), value)) {
storeConstant(name, value);
removeAutoload(name);
}
} else {
storeConstant(name, value);
}
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "remove_const", required = 1, visibility = PRIVATE)
public IRubyObject remove_const(ThreadContext context, IRubyObject rubyName) {
String id = validateConstant(rubyName);
IRubyObject value = deleteConstant(id);
if (value != null) { // found it!
invalidateConstantCache(id);
if (value != UNDEF) return value;
// autoload entry
removeAutoload(id);
// FIXME: I'm not sure this is right, but the old code returned
// the undef, which definitely isn't right...
return context.nil;
}
if (hasConstantInHierarchy(id)) throw cannotRemoveError(id);
throw context.runtime.newNameError("constant " + id + " not defined for " + getName(), id);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "remove_const", required = 1, visibility = PRIVATE)
public IRubyObject remove_const(ThreadContext context, IRubyObject rubyName) {
String id = validateConstant(rubyName);
IRubyObject value = deleteConstant(id);
if (value != null) { // found it!
invalidateConstantCache(id);
if (value != UNDEF) return value;
// autoload entry
removeAutoload(id);
// FIXME: I'm not sure this is right, but the old code returned
// the undef, which definitely isn't right...
return context.nil;
}
if (hasConstantInHierarchy(id)) throw cannotRemoveError(id);
throw context.runtime.newNameError("constant " + id + " not defined for " + getName(), id);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "remove_const", required = 1, visibility = PRIVATE)
public IRubyObject remove_const(ThreadContext context, IRubyObject rubyName) {
String name = validateConstant(rubyName.asJavaString());
IRubyObject value;
if ((value = deleteConstant(name)) != null) {
invalidateConstantCache(name);
if (value != UNDEF) {
return value;
}
removeAutoload(name);
// FIXME: I'm not sure this is right, but the old code returned
// the undef, which definitely isn't right...
return context.runtime.getNil();
}
if (hasConstantInHierarchy(name)) {
throw cannotRemoveError(name);
}
throw context.runtime.newNameError("constant " + name + " not defined for " + getName(), name);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "remove_const", required = 1, visibility = PRIVATE)
public IRubyObject remove_const(ThreadContext context, IRubyObject rubyName) {
String name = validateConstant(rubyName.asJavaString());
IRubyObject value;
if ((value = deleteConstant(name)) != null) {
invalidateConstantCache(name);
if (value != UNDEF) {
return value;
}
removeAutoload(name);
// FIXME: I'm not sure this is right, but the old code returned
// the undef, which definitely isn't right...
return context.runtime.getNil();
}
if (hasConstantInHierarchy(name)) {
throw cannotRemoveError(name);
}
throw context.runtime.newNameError("constant " + name + " not defined for " + getName(), name);
}
内容来源于网络,如有侵权,请联系作者删除!