本文整理了Java中org.jruby.RubyModule.isClass
方法的一些代码示例,展示了RubyModule.isClass
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.isClass
方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:isClass
[英]Is class var defined? Ruby C equivalent = "rb_cvar_defined"
[中]是否定义了类变量?Ruby C equired=“rb_cvar_defined”
代码示例来源:origin: org.jruby/jruby-core
public static RubyClass getClassFromPath(Ruby runtime, String path) {
final RubyModule value = getConstantFromPath(runtime, path);
if ( ! value.isClass() ) throw runtime.newArgumentError(path + " does not refer class");
return (RubyClass) value;
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyClass getClassFromPath(Ruby runtime, String path) {
final RubyModule value = getConstantFromPath(runtime, path);
if ( ! value.isClass() ) throw runtime.newArgumentError(path + " does not refer class");
return (RubyClass) value;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static RubyClass getClassFromPath(Ruby runtime, String path) {
RubyModule value = runtime.getClassFromPath(path);
if (!value.isClass()) throw runtime.newArgumentError(path + " does not refer class");
return (RubyClass)value;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static RubyClass getClassFromPath(Ruby runtime, String path) {
RubyModule value = runtime.getClassFromPath(path);
if (!value.isClass()) throw runtime.newArgumentError(path + " does not refer class");
return (RubyClass)value;
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public final void checkFrozen() {
if ( isFrozen() ) {
throw getRuntime().newFrozenError(isClass() ? "class" : "module");
}
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public final void checkFrozen() {
if ( isFrozen() ) {
throw getRuntime().newFrozenError(isClass() ? "class" : "module");
}
}
代码示例来源:origin: org.jruby/jruby-complete
private IRubyObject getConstantSkipAutoload(String name, boolean inherit, boolean includeObject) {
IRubyObject constant = iterateConstantNoConstMissing(name, this, inherit, false);
if (constant == null && !isClass() && includeObject) {
constant = iterateConstantNoConstMissing(name, getRuntime().getObject(), inherit, false);
}
return constant;
}
代码示例来源:origin: org.jruby/jruby-complete
public IRubyObject getConstantNoConstMissing(String name, boolean inherit, boolean includeObject) {
IRubyObject constant = iterateConstantNoConstMissing(name, this, inherit, true);
if (constant == null && !isClass() && includeObject) {
constant = iterateConstantNoConstMissing(name, getRuntime().getObject(), inherit, true);
}
return constant;
}
代码示例来源:origin: org.jruby/jruby-core
private IRubyObject getConstantSkipAutoload(String name, boolean inherit, boolean includeObject) {
IRubyObject constant = iterateConstantNoConstMissing(name, this, inherit, false);
if (constant == null && !isClass() && includeObject) {
constant = iterateConstantNoConstMissing(name, getRuntime().getObject(), inherit, false);
}
return constant;
}
代码示例来源:origin: org.jruby/jruby-core
public IRubyObject getConstantNoConstMissing(String name, boolean inherit, boolean includeObject) {
IRubyObject constant = iterateConstantNoConstMissing(name, this, inherit, true);
if (constant == null && !isClass() && includeObject) {
constant = iterateConstantNoConstMissing(name, getRuntime().getObject(), inherit, true);
}
return constant;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public IRubyObject getConstantNoConstMissing(String name, boolean inherit, boolean includeObject) {
assert IdUtil.isConstant(name);
IRubyObject constant = iterateConstantNoConstMissing(name, this, inherit);
if (constant == null && !isClass() && includeObject) {
constant = iterateConstantNoConstMissing(name, getRuntime().getObject(), inherit);
}
return constant;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public IRubyObject getConstantNoConstMissing(String name, boolean inherit, boolean includeObject) {
assert IdUtil.isConstant(name);
IRubyObject constant = iterateConstantNoConstMissing(name, this, inherit);
if (constant == null && !isClass() && includeObject) {
constant = iterateConstantNoConstMissing(name, getRuntime().getObject(), inherit);
}
return constant;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static String getPathFromClass(RubyModule clazz) {
String path = clazz.getName();
if (path.charAt(0) == '#') {
String classOrModule = clazz.isClass() ? "class" : "module";
throw clazz.getRuntime().newTypeError("can't dump anonymous " + classOrModule + " " + path);
}
RubyModule real = clazz.isModule() ? clazz : ((RubyClass)clazz).getRealClass();
if (clazz.getRuntime().getClassFromPath(path) != real) {
throw clazz.getRuntime().newTypeError(path + " can't be referred");
}
return path;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static String getPathFromClass(RubyModule clazz) {
String path = clazz.getName();
if (path.charAt(0) == '#') {
String classOrModule = clazz.isClass() ? "class" : "module";
throw clazz.getRuntime().newTypeError("can't dump anonymous " + classOrModule + " " + path);
}
RubyModule real = clazz.isModule() ? clazz : ((RubyClass)clazz).getRealClass();
if (clazz.getRuntime().getClassFromPath(path) != real) {
throw clazz.getRuntime().newTypeError(path + " can't be referred");
}
return path;
}
代码示例来源:origin: org.jruby/jruby-complete
/** separate path for MetaClass construction
*
*/
protected RubyModule(Ruby runtime, RubyClass metaClass, boolean objectSpace) {
super(runtime, metaClass, objectSpace);
id = runtime.allocModuleId();
runtime.addModule(this);
// if (parent == null) parent = runtime.getObject();
setFlag(NEEDSIMPL_F, !isClass());
updateGeneration(runtime);
if (runtime.getInstanceConfig().isProfiling()) {
cacheEntryFactory = new ProfilingCacheEntryFactory(runtime, NormalCacheEntryFactory);
} else {
cacheEntryFactory = NormalCacheEntryFactory;
}
// set up an invalidator for use in new optimization strategies
methodInvalidator = OptoFactory.newMethodInvalidator(this);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/** separate path for MetaClass construction
*
*/
protected RubyModule(Ruby runtime, RubyClass metaClass, boolean objectSpace) {
super(runtime, metaClass, objectSpace);
id = runtime.allocModuleId();
runtime.addModule(this);
// if (parent == null) parent = runtime.getObject();
setFlag(USER7_F, !isClass());
generationObject = generation = runtime.getNextModuleGeneration();
if (runtime.getInstanceConfig().isProfiling()) {
cacheEntryFactory = new ProfilingCacheEntryFactory(NormalCacheEntryFactory);
} else {
cacheEntryFactory = NormalCacheEntryFactory;
}
// set up an invalidator for use in new optimization strategies
methodInvalidator = OptoFactory.newMethodInvalidator(this);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/** separate path for MetaClass construction
*
*/
protected RubyModule(Ruby runtime, RubyClass metaClass, boolean objectSpace) {
super(runtime, metaClass, objectSpace);
id = runtime.allocModuleId();
runtime.addModule(this);
// if (parent == null) parent = runtime.getObject();
setFlag(USER7_F, !isClass());
generationObject = generation = runtime.getNextModuleGeneration();
if (runtime.getInstanceConfig().isProfiling()) {
cacheEntryFactory = new ProfilingCacheEntryFactory(NormalCacheEntryFactory);
} else {
cacheEntryFactory = NormalCacheEntryFactory;
}
// set up an invalidator for use in new optimization strategies
methodInvalidator = OptoFactory.newMethodInvalidator(this);
}
代码示例来源:origin: org.jruby/jruby-core
/** separate path for MetaClass construction
*
*/
protected RubyModule(Ruby runtime, RubyClass metaClass, boolean objectSpace) {
super(runtime, metaClass, objectSpace);
id = runtime.allocModuleId();
runtime.addModule(this);
// if (parent == null) parent = runtime.getObject();
setFlag(NEEDSIMPL_F, !isClass());
updateGeneration(runtime);
if (runtime.getInstanceConfig().isProfiling()) {
cacheEntryFactory = new ProfilingCacheEntryFactory(runtime, NormalCacheEntryFactory);
} else {
cacheEntryFactory = NormalCacheEntryFactory;
}
// set up an invalidator for use in new optimization strategies
methodInvalidator = OptoFactory.newMethodInvalidator(this);
}
代码示例来源:origin: org.jruby/jruby-complete
public static String getPathFromClass(RubyModule clazz) {
RubyString path = clazz.rubyName();
if (path.charAt(0) == '#') {
Ruby runtime = clazz.getRuntime();
String type = clazz.isClass() ? "class" : "module";
throw runtime.newTypeError(str(runtime, "can't dump anonymous " + type + " ", types(runtime, clazz)));
}
RubyModule real = clazz.isModule() ? clazz : ((RubyClass)clazz).getRealClass();
Ruby runtime = clazz.getRuntime();
// FIXME: This is weird why we do this. rubyName should produce something which can be referred so what example
// will this fail on? If there is a failing case then passing asJavaString may be broken since it will not be
// a properly encoded string. If this is an issue we should make a clazz.IdPath where all segments are returned
// by their id names.
if (runtime.getClassFromPath(path.asJavaString()) != real) {
throw runtime.newTypeError(str(runtime, types(runtime, clazz), " can't be referred"));
}
return path.asJavaString();
}
代码示例来源:origin: org.jruby/jruby-core
public static String getPathFromClass(RubyModule clazz) {
RubyString path = clazz.rubyName();
if (path.charAt(0) == '#') {
Ruby runtime = clazz.getRuntime();
String type = clazz.isClass() ? "class" : "module";
throw runtime.newTypeError(str(runtime, "can't dump anonymous " + type + " ", types(runtime, clazz)));
}
RubyModule real = clazz.isModule() ? clazz : ((RubyClass)clazz).getRealClass();
Ruby runtime = clazz.getRuntime();
// FIXME: This is weird why we do this. rubyName should produce something which can be referred so what example
// will this fail on? If there is a failing case then passing asJavaString may be broken since it will not be
// a properly encoded string. If this is an issue we should make a clazz.IdPath where all segments are returned
// by their id names.
if (runtime.getClassFromPath(path.asJavaString()) != real) {
throw runtime.newTypeError(str(runtime, types(runtime, clazz), " can't be referred"));
}
return path.asJavaString();
}
内容来源于网络,如有侵权,请联系作者删除!