本文整理了Java中org.jruby.RubyClass.isIncluded
方法的一些代码示例,展示了RubyClass.isIncluded
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyClass.isIncluded
方法的具体详情如下:
包路径:org.jruby.RubyClass
类名称:RubyClass
方法名:isIncluded
暂无
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Is the given class a wrapper for the specified module?
*
* @param theClass The class to inspect
* @param theModule The module we're looking for
* @return true if the class is a wrapper for the module, false otherwise
*/
private boolean doesTheClassWrapTheModule(RubyClass theClass, RubyModule theModule) {
return theClass.isIncluded() &&
theClass.getNonIncludedClass() == theModule.getNonIncludedClass();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Is the given class a wrapper for the specified module?
*
* @param theClass The class to inspect
* @param theModule The module we're looking for
* @return true if the class is a wrapper for the module, false otherwise
*/
private boolean doesTheClassWrapTheModule(RubyClass theClass, RubyModule theModule) {
return theClass.isIncluded() &&
theClass.getNonIncludedClass() == theModule.getNonIncludedClass();
}
代码示例来源:origin: org.jruby/jruby-core
/** Return the real super class of this class.
*
* rb_class_superclass
*
*/
@JRubyMethod(name = "superclass")
public IRubyObject superclass(ThreadContext context) {
RubyClass superClazz = superClass;
if (superClazz == null) {
if (metaClass == runtime.getBasicObject().getMetaClass()) return context.nil;
throw runtime.newTypeError("uninitialized class");
}
while (superClazz != null && (superClazz.isIncluded() || superClazz.isPrepended())) {
superClazz = superClazz.superClass;
}
return superClazz != null ? superClazz : context.nil;
}
代码示例来源:origin: org.jruby/jruby-complete
/** Return the real super class of this class.
*
* rb_class_superclass
*
*/
@JRubyMethod(name = "superclass")
public IRubyObject superclass(ThreadContext context) {
RubyClass superClazz = superClass;
if (superClazz == null) {
if (metaClass == runtime.getBasicObject().getMetaClass()) return context.nil;
throw runtime.newTypeError("uninitialized class");
}
while (superClazz != null && (superClazz.isIncluded() || superClazz.isPrepended())) {
superClazz = superClazz.superClass;
}
return superClazz != null ? superClazz : context.nil;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/** Return the real super class of this class.
*
* rb_class_superclass
*
*/
@JRubyMethod(name = "superclass")
public IRubyObject superclass(ThreadContext context) {
RubyClass superClazz = superClass;
if (superClazz == null) {
if (runtime.is1_9() && metaClass == runtime.getBasicObject().getMetaClass()) return runtime.getNil();
throw runtime.newTypeError("uninitialized class");
}
while (superClazz != null && superClazz.isIncluded()) superClazz = superClazz.superClass;
return superClazz != null ? superClazz : runtime.getNil();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/** Return the real super class of this class.
*
* rb_class_superclass
*
*/
@JRubyMethod(name = "superclass")
public IRubyObject superclass(ThreadContext context) {
RubyClass superClazz = superClass;
if (superClazz == null) {
if (runtime.is1_9() && metaClass == runtime.getBasicObject().getMetaClass()) return runtime.getNil();
throw runtime.newTypeError("uninitialized class");
}
while (superClazz != null && superClazz.isIncluded()) superClazz = superClazz.superClass;
return superClazz != null ? superClazz : runtime.getNil();
}
代码示例来源:origin: org.jruby/jruby-complete
private void addActivatedRefinement(ThreadContext context, RubyModule moduleToRefine, RubyModule refinement) {
// RubyClass superClass = getAlreadyActivatedRefinementWrapper(classWeAreRefining, refinement);
// if (superClass == null) return; // already been refined and added to refinementwrapper
RubyClass superClass = null;
RubyClass c = activatedRefinements.get(moduleToRefine);
if (c != null) {
superClass = c;
while (c != null && c.isIncluded()) {
if (((IncludedModuleWrapper)c).getNonIncludedClass() == refinement) {
/* already used refinement */
return;
}
c = c.getSuperClass();
}
}
refinement.setFlag(IS_OVERLAID_F, true);
IncludedModuleWrapper iclass = new IncludedModuleWrapper(context.runtime, superClass, refinement);
c = iclass;
c.refinedClass = moduleToRefine;
for (refinement = refinement.getSuperClass(); refinement != null; refinement = refinement.getSuperClass()) {
refinement.setFlag(IS_OVERLAID_F, true);
c.setSuperClass(new IncludedModuleWrapper(context.runtime, c.getSuperClass(), refinement));
c = c.getSuperClass();
c.refinedClass = moduleToRefine;
}
activatedRefinements.put(moduleToRefine, iclass);
}
代码示例来源:origin: org.jruby/jruby-core
private void addActivatedRefinement(ThreadContext context, RubyModule moduleToRefine, RubyModule refinement) {
// RubyClass superClass = getAlreadyActivatedRefinementWrapper(classWeAreRefining, refinement);
// if (superClass == null) return; // already been refined and added to refinementwrapper
RubyClass superClass = null;
RubyClass c = activatedRefinements.get(moduleToRefine);
if (c != null) {
superClass = c;
while (c != null && c.isIncluded()) {
if (((IncludedModuleWrapper)c).getNonIncludedClass() == refinement) {
/* already used refinement */
return;
}
c = c.getSuperClass();
}
}
refinement.setFlag(IS_OVERLAID_F, true);
IncludedModuleWrapper iclass = new IncludedModuleWrapper(context.runtime, superClass, refinement);
c = iclass;
c.refinedClass = moduleToRefine;
for (refinement = refinement.getSuperClass(); refinement != null; refinement = refinement.getSuperClass()) {
refinement.setFlag(IS_OVERLAID_F, true);
c.setSuperClass(new IncludedModuleWrapper(context.runtime, c.getSuperClass(), refinement));
c = c.getSuperClass();
c.refinedClass = moduleToRefine;
}
activatedRefinements.put(moduleToRefine, iclass);
}
代码示例来源:origin: org.jruby/jruby-complete
if (nextClass.isIncluded()) {
代码示例来源:origin: org.jruby/jruby-core
if (nextClass.isIncluded()) {
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/** w_extended
*
*/
private RubyClass dumpExtended(RubyClass type) throws IOException {
if(type.isSingleton()) {
if (hasSingletonMethods(type) || type.hasVariables()) { // any ivars, since we don't have __attached__ ivar now
throw type.getRuntime().newTypeError("singleton can't be dumped");
}
type = type.getSuperClass();
}
while(type.isIncluded()) {
write('e');
writeAndRegisterSymbol(((IncludedModuleWrapper)type).getNonIncludedClass().getName());
type = type.getSuperClass();
}
return type;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/** w_extended
*
*/
private RubyClass dumpExtended(RubyClass type) throws IOException {
if(type.isSingleton()) {
if (hasSingletonMethods(type) || type.hasVariables()) { // any ivars, since we don't have __attached__ ivar now
throw type.getRuntime().newTypeError("singleton can't be dumped");
}
type = type.getSuperClass();
}
while(type.isIncluded()) {
write('e');
writeAndRegisterSymbol(((IncludedModuleWrapper)type).getNonIncludedClass().getName());
type = type.getSuperClass();
}
return type;
}
代码示例来源:origin: org.jruby/jruby-core
/** w_extended
*
*/
private RubyClass dumpExtended(RubyClass type) throws IOException {
if(type.isSingleton()) {
if (hasSingletonMethods(type) || type.hasVariables()) { // any ivars, since we don't have __attached__ ivar now
throw type.getRuntime().newTypeError("singleton can't be dumped");
}
type = type.getSuperClass();
}
while(type.isIncluded()) {
write('e');
writeAndRegisterSymbol(RubySymbol.newSymbol(runtime, type.getNonIncludedClass().getName()).getBytes());
type = type.getSuperClass();
}
return type;
}
代码示例来源:origin: org.jruby/jruby-complete
/** w_extended
*
*/
private RubyClass dumpExtended(RubyClass type) throws IOException {
if(type.isSingleton()) {
if (hasSingletonMethods(type) || type.hasVariables()) { // any ivars, since we don't have __attached__ ivar now
throw type.getRuntime().newTypeError("singleton can't be dumped");
}
type = type.getSuperClass();
}
while(type.isIncluded()) {
write('e');
writeAndRegisterSymbol(RubySymbol.newSymbol(runtime, type.getNonIncludedClass().getName()).getBytes());
type = type.getSuperClass();
}
return type;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private RubyArray singletonMethods(ThreadContext context, IRubyObject[] args, MethodsCollector collect) {
boolean all = true;
if(args.length == 1) {
all = args[0].isTrue();
}
if (getMetaClass().isSingleton()) {
IRubyObject[] methodsArgs = new IRubyObject[]{context.runtime.getFalse()};
RubyArray singletonMethods = collect.instanceMethods(getMetaClass(), methodsArgs);
if (all) {
RubyClass superClass = getMetaClass().getSuperClass();
while (superClass.isSingleton() || superClass.isIncluded()) {
singletonMethods.concat(collect.instanceMethods(superClass, methodsArgs));
superClass = superClass.getSuperClass();
}
}
singletonMethods.uniq_bang(context);
return singletonMethods;
}
return context.runtime.newEmptyArray();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private RubyArray singletonMethods(ThreadContext context, IRubyObject[] args, MethodsCollector collect) {
boolean all = true;
if(args.length == 1) {
all = args[0].isTrue();
}
if (getMetaClass().isSingleton()) {
IRubyObject[] methodsArgs = new IRubyObject[]{context.runtime.getFalse()};
RubyArray singletonMethods = collect.instanceMethods(getMetaClass(), methodsArgs);
if (all) {
RubyClass superClass = getMetaClass().getSuperClass();
while (superClass.isSingleton() || superClass.isIncluded()) {
singletonMethods.concat(collect.instanceMethods(superClass, methodsArgs));
superClass = superClass.getSuperClass();
}
}
singletonMethods.uniq_bang(context);
return singletonMethods;
}
return context.runtime.newEmptyArray();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
while (tmp != null && tmp.isIncluded()) tmp = tmp.getSuperClass(); // need to skip IncludedModuleWrappers
if (tmp != null) tmp = tmp.getRealClass();
if (tmp != superClazz) throw runtime.newTypeError("superclass mismatch for class " + name);
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
while (tmp != null && tmp.isIncluded()) tmp = tmp.getSuperClass(); // need to skip IncludedModuleWrappers
if (tmp != null) tmp = tmp.getRealClass();
if (tmp != superClazz) throw runtime.newTypeError("superclass mismatch for class " + name);
代码示例来源:origin: org.jruby/jruby-complete
while (tmp != null && tmp.isIncluded()) tmp = tmp.getSuperClass(); // need to skip IncludedModuleWrappers
if (tmp != null) tmp = tmp.getRealClass();
if (tmp != superClazz) throw runtime.newTypeError(str(runtime, "superclass mismatch for class ", ids(runtime, name)));
代码示例来源:origin: org.jruby/jruby-core
while (tmp != null && tmp.isIncluded()) tmp = tmp.getSuperClass(); // need to skip IncludedModuleWrappers
if (tmp != null) tmp = tmp.getRealClass();
if (tmp != superClazz) throw runtime.newTypeError(str(runtime, "superclass mismatch for class ", ids(runtime, name)));
内容来源于网络,如有侵权,请联系作者删除!