本文整理了Java中org.jruby.RubyModule.fetchConstant
方法的一些代码示例,展示了RubyModule.fetchConstant
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.fetchConstant
方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:fetchConstant
暂无
代码示例来源:origin: org.jruby/jruby-core
public IRubyObject fetchConstant(String name) {
return fetchConstant(name, true);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Deprecated
public IRubyObject fastFetchConstant(String internedName) {
return fetchConstant(internedName);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Deprecated
public IRubyObject fastFetchConstant(String internedName) {
return fetchConstant(internedName);
}
代码示例来源:origin: org.jruby/jruby-complete
@Deprecated
public IRubyObject fastFetchConstant(String internedName) {
return fetchConstant(internedName);
}
代码示例来源:origin: org.jruby/jruby-core
@Deprecated
public IRubyObject fastFetchConstant(String internedName) {
return fetchConstant(internedName);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public IRubyObject getConstantAt(String name, boolean includePrivate) {
IRubyObject value = fetchConstant(name, includePrivate);
return value == UNDEF ? resolveUndefConstant(name) : value;
}
代码示例来源:origin: org.jruby/jruby-core
/**
* Gets a constant back from lexical search from the cref in this scope.
* As it is for defined? we will not forced resolution of autoloads nor
* call const_defined
*/
public IRubyObject getConstantDefined(String internedName) {
IRubyObject result = cref.fetchConstant(internedName);
if (result != null) return result;
return previousCRefScope == null ? null : previousCRefScope.getConstantDefinedNoObject(internedName);
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* Gets a constant back from lexical search from the cref in this scope.
* As it is for defined? we will not forced resolution of autoloads nor
* call const_defined
*/
public IRubyObject getConstantDefined(String internedName) {
IRubyObject result = cref.fetchConstant(internedName);
if (result != null) return result;
return previousCRefScope == null ? null : previousCRefScope.getConstantDefinedNoObject(internedName);
}
代码示例来源:origin: org.jruby/jruby-core
private static RubyModule cacheConstant(final RubyModule owner, // e.g. ::Java
final String constName, final RubyModule packageOrClass, final boolean hidden) {
if ( packageOrClass != null ) {
// NOTE: if it's a package createPackageModule already set the constant
// ... but in case it's a (top-level) Java class name we still need to:
synchronized (owner) {
final IRubyObject alreadySet = owner.fetchConstant(constName);
if ( alreadySet != null ) return (RubyModule) alreadySet;
owner.setConstant(constName, packageOrClass, hidden);
}
return packageOrClass;
}
return null;
}
代码示例来源:origin: org.jruby/jruby-core
public IRubyObject getConstantAt(String name, boolean includePrivate) {
IRubyObject value = fetchConstant(name, includePrivate);
return value == UNDEF ? resolveUndefConstant(name) : value;
}
代码示例来源:origin: org.jruby/jruby-complete
public IRubyObject getConstantAt(String name, boolean includePrivate) {
IRubyObject value = fetchConstant(name, includePrivate);
return value == UNDEF ? resolveUndefConstant(name) : value;
}
代码示例来源:origin: org.jruby/jruby-complete
private static RubyModule cacheConstant(final RubyModule owner, // e.g. ::Java
final String constName, final RubyModule packageOrClass, final boolean hidden) {
if ( packageOrClass != null ) {
// NOTE: if it's a package createPackageModule already set the constant
// ... but in case it's a (top-level) Java class name we still need to:
synchronized (owner) {
final IRubyObject alreadySet = owner.fetchConstant(constName);
if ( alreadySet != null ) return (RubyModule) alreadySet;
owner.setConstant(constName, packageOrClass, hidden);
}
return packageOrClass;
}
return null;
}
代码示例来源:origin: org.jruby/jruby-complete
public IRubyObject getConstantInner(String internedName) {
IRubyObject result = cref.fetchConstant(internedName);
if (result != null) {
return result == RubyObject.UNDEF ? cref.resolveUndefConstant(internedName) : result;
}
return previousCRefScope == null ? null : previousCRefScope.getConstantInnerNoObject(internedName);
}
代码示例来源:origin: org.jruby/jruby-complete
private static RubyModule createPackageModule(final Ruby runtime,
final RubyModule parentModule, final String name, final String packageString) {
final RubyModule packageModule = JavaPackage.newPackage(runtime, packageString, parentModule);
synchronized (parentModule) { // guard initializing in multiple threads
final IRubyObject packageAlreadySet = parentModule.fetchConstant(name);
if ( packageAlreadySet != null ) {
return (RubyModule) packageAlreadySet;
}
parentModule.setConstant(name.intern(), packageModule);
//MetaClass metaClass = (MetaClass) packageModule.getMetaClass();
//metaClass.setAttached(packageModule);
}
return packageModule;
}
代码示例来源:origin: org.jruby/jruby-complete
private static IRubyObject iterateConstantNoConstMissing(String name,
RubyModule init, boolean inherit, boolean loadConstant) {
for (RubyModule mod = init; mod != null; mod = mod.getSuperClass()) {
final IRubyObject value = mod.fetchConstant(name, true);
if ( value == UNDEF ) return mod.getAutoloadConstant(name, loadConstant);
if ( value != null ) return value;
if ( ! inherit ) break;
}
return null;
}
代码示例来源:origin: org.jruby/jruby-core
public IRubyObject getConstantInner(String internedName) {
IRubyObject result = cref.fetchConstant(internedName);
if (result != null) {
return result == RubyObject.UNDEF ? cref.resolveUndefConstant(internedName) : result;
}
return previousCRefScope == null ? null : previousCRefScope.getConstantInnerNoObject(internedName);
}
代码示例来源:origin: org.jruby/jruby-core
private static IRubyObject iterateConstantNoConstMissing(String name,
RubyModule init, boolean inherit, boolean loadConstant) {
for (RubyModule mod = init; mod != null; mod = mod.getSuperClass()) {
final IRubyObject value = mod.fetchConstant(name, true);
if ( value == UNDEF ) return mod.getAutoloadConstant(name, loadConstant);
if ( value != null ) return value;
if ( ! inherit ) break;
}
return null;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public IRubyObject getConstantInner(String internedName) {
IRubyObject result = cref.fetchConstant(internedName);
if (result != null) {
return result == RubyObject.UNDEF ? cref.resolveUndefConstant(internedName) : result;
}
return previousCRefScope == null ? null : previousCRefScope.getConstantInnerNoObject(internedName);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public IRubyObject getConstantInner(String internedName) {
IRubyObject result = cref.fetchConstant(internedName);
if (result != null) {
return result == RubyObject.UNDEF ? cref.resolveUndefConstant(internedName) : result;
}
return previousCRefScope == null ? null : previousCRefScope.getConstantInnerNoObject(internedName);
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* This version searches superclasses if we're starting with Object. This
* corresponds to logic in rb_const_defined_0 that recurses for Object only.
*
* @param name the constant name to find
* @return the constant, or null if it was not found
*/
public IRubyObject getConstantAtSpecial(String name) {
IRubyObject value;
if (this == getRuntime().getObject()) {
value = getConstantNoConstMissing(name);
} else {
value = fetchConstant(name);
}
return value == UNDEF ? resolveUndefConstant(name) : value;
}
内容来源于网络,如有侵权,请联系作者删除!