本文整理了Java中org.jruby.RubyModule.setSuperClass
方法的一些代码示例,展示了RubyModule.setSuperClass
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.setSuperClass
方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:setSuperClass
暂无
代码示例来源:origin: org.jruby/jruby-complete
private RubyModule createNewRefinedModule(ThreadContext context, RubyModule moduleToRefine) {
Ruby runtime = context.runtime;
RubyModule newRefinement = new RubyModule(runtime);
RubyClass superClass = refinementSuperclass(runtime, this, moduleToRefine);
newRefinement.setSuperClass(superClass);
newRefinement.setFlag(REFINED_MODULE_F, true);
newRefinement.setFlag(NEEDSIMPL_F, false); // Refinement modules should not do implementer check
newRefinement.refinedClass = moduleToRefine;
newRefinement.definedAt = this;
refinements.put(moduleToRefine, newRefinement);
return newRefinement;
}
代码示例来源:origin: org.jruby/jruby-core
private RubyModule createNewRefinedModule(ThreadContext context, RubyModule moduleToRefine) {
Ruby runtime = context.runtime;
RubyModule newRefinement = new RubyModule(runtime);
RubyClass superClass = refinementSuperclass(runtime, this, moduleToRefine);
newRefinement.setSuperClass(superClass);
newRefinement.setFlag(REFINED_MODULE_F, true);
newRefinement.setFlag(NEEDSIMPL_F, false); // Refinement modules should not do implementer check
newRefinement.refinedClass = moduleToRefine;
newRefinement.definedAt = this;
refinements.put(moduleToRefine, newRefinement);
return newRefinement;
}
代码示例来源:origin: org.jruby/jruby-complete
private static void usingRefinement(Ruby runtime, RubyModule cref, RubyModule klass, RubyModule module) {
RubyModule superclass = getAlreadyRefinementWrapper(cref, klass, module);
if (superclass == null) return; // already been refined and added to refinementwrapper
module.setFlag(IS_OVERLAID_F, true);
superclass = refinementSuperclass(runtime, klass, module);
RubyModule c, iclass = new IncludedModuleWrapper(runtime, (RubyClass) superclass, module);
c = iclass;
c.refinedClass = klass;
// RCLASS_M_TBL(OBJ_WB_UNPROTECT(c)) =
// RCLASS_M_TBL(OBJ_WB_UNPROTECT(module)); /* TODO: check unprotecting */
for (module = module.getSuperClass(); module != null && module != klass; module = module.getSuperClass()) {
module.setFlag(IS_OVERLAID_F, true);
c.setSuperClass(new IncludedModuleWrapper(cref.getRuntime(), c.getSuperClass(), module));
c = c.getSuperClass();
c.refinedClass = klass;
}
cref.refinements.put(klass, iclass);
}
代码示例来源:origin: org.jruby/jruby-core
private static void usingRefinement(Ruby runtime, RubyModule cref, RubyModule klass, RubyModule module) {
RubyModule superclass = getAlreadyRefinementWrapper(cref, klass, module);
if (superclass == null) return; // already been refined and added to refinementwrapper
module.setFlag(IS_OVERLAID_F, true);
superclass = refinementSuperclass(runtime, klass, module);
RubyModule c, iclass = new IncludedModuleWrapper(runtime, (RubyClass) superclass, module);
c = iclass;
c.refinedClass = klass;
// RCLASS_M_TBL(OBJ_WB_UNPROTECT(c)) =
// RCLASS_M_TBL(OBJ_WB_UNPROTECT(module)); /* TODO: check unprotecting */
for (module = module.getSuperClass(); module != null && module != klass; module = module.getSuperClass()) {
module.setFlag(IS_OVERLAID_F, true);
c.setSuperClass(new IncludedModuleWrapper(cref.getRuntime(), c.getSuperClass(), module));
c = c.getSuperClass();
c.refinedClass = klass;
}
cref.refinements.put(klass, iclass);
}
代码示例来源:origin: org.jruby/jruby-core
/**
* Actually proceed with including the specified module above the given target
* in a hierarchy. Return the new module wrapper.
*
* @param insertAbove The hierarchy target above which to include the wrapped module
* @param moduleToInclude The module to wrap and include
* @return The new module wrapper resulting from this include
*/
private RubyModule proceedWithInclude(RubyModule insertAbove, RubyModule moduleToInclude) {
// In the current logic, if we getService here we know that module is not an
// IncludedModuleWrapper, so there's no need to fish out the delegate. But just
// in case the logic should change later, let's do it anyway
RubyClass wrapper = new IncludedModuleWrapper(getRuntime(), insertAbove.getSuperClass(), moduleToInclude);
// if the insertion point is a class, update subclass lists
if (insertAbove instanceof RubyClass) {
RubyClass insertAboveClass = (RubyClass)insertAbove;
// if there's a non-null superclass, we're including into a normal class hierarchy;
// update subclass relationships to avoid stale parent/child relationships
if (insertAboveClass.getSuperClass() != null) {
insertAboveClass.getSuperClass().replaceSubclass(insertAboveClass, wrapper);
}
wrapper.addSubclass(insertAboveClass);
}
insertAbove.setSuperClass(wrapper);
insertAbove = insertAbove.getSuperClass();
return insertAbove;
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* Actually proceed with including the specified module above the given target
* in a hierarchy. Return the new module wrapper.
*
* @param insertAbove The hierarchy target above which to include the wrapped module
* @param moduleToInclude The module to wrap and include
* @return The new module wrapper resulting from this include
*/
private RubyModule proceedWithInclude(RubyModule insertAbove, RubyModule moduleToInclude) {
// In the current logic, if we getService here we know that module is not an
// IncludedModuleWrapper, so there's no need to fish out the delegate. But just
// in case the logic should change later, let's do it anyway
RubyClass wrapper = new IncludedModuleWrapper(getRuntime(), insertAbove.getSuperClass(), moduleToInclude);
// if the insertion point is a class, update subclass lists
if (insertAbove instanceof RubyClass) {
RubyClass insertAboveClass = (RubyClass)insertAbove;
// if there's a non-null superclass, we're including into a normal class hierarchy;
// update subclass relationships to avoid stale parent/child relationships
if (insertAboveClass.getSuperClass() != null) {
insertAboveClass.getSuperClass().replaceSubclass(insertAboveClass, wrapper);
}
wrapper.addSubclass(insertAboveClass);
}
insertAbove.setSuperClass(wrapper);
insertAbove = insertAbove.getSuperClass();
return insertAbove;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
insertAbove.setSuperClass(wrapper);
insertAbove = insertAbove.getSuperClass();
return insertAbove;
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/** rb_mod_init_copy
*
*/
@JRubyMethod(name = "initialize_copy", required = 1)
@Override
public IRubyObject initialize_copy(IRubyObject original) {
super.initialize_copy(original);
RubyModule originalModule = (RubyModule)original;
if (!getMetaClass().isSingleton()) setMetaClass(originalModule.getSingletonClassClone());
setSuperClass(originalModule.getSuperClass());
if (originalModule.hasVariables()) syncVariables(originalModule);
syncConstants(originalModule);
originalModule.cloneMethods(this);
return this;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/** rb_mod_init_copy
*
*/
@JRubyMethod(name = "initialize_copy", required = 1)
@Override
public IRubyObject initialize_copy(IRubyObject original) {
super.initialize_copy(original);
RubyModule originalModule = (RubyModule)original;
if (!getMetaClass().isSingleton()) setMetaClass(originalModule.getSingletonClassClone());
setSuperClass(originalModule.getSuperClass());
if (originalModule.hasVariables()) syncVariables(originalModule);
syncConstants(originalModule);
originalModule.cloneMethods(this);
return this;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
insertAbove.setSuperClass(wrapper);
insertAbove = insertAbove.getSuperClass();
return insertAbove;
代码示例来源:origin: org.jruby/jruby-complete
/** mri: rb_mod_init_copy
*
*/
@JRubyMethod(name = "initialize_copy", required = 1, visibility = Visibility.PRIVATE)
@Override
public IRubyObject initialize_copy(IRubyObject original) {
if (this instanceof RubyClass) {
checkSafeTypeToCopy((RubyClass) original);
}
super.initialize_copy(original);
RubyModule originalModule = (RubyModule)original;
if (!getMetaClass().isSingleton()) {
setMetaClass(originalModule.getSingletonClassCloneAndAttach(this));
}
setSuperClass(originalModule.getSuperClass());
if (originalModule.hasVariables()) syncVariables(originalModule);
syncConstants(originalModule);
originalModule.cloneMethods(this);
return this;
}
代码示例来源:origin: org.jruby/jruby-core
/** mri: rb_mod_init_copy
*
*/
@JRubyMethod(name = "initialize_copy", required = 1, visibility = Visibility.PRIVATE)
@Override
public IRubyObject initialize_copy(IRubyObject original) {
if (this instanceof RubyClass) {
checkSafeTypeToCopy((RubyClass) original);
}
super.initialize_copy(original);
RubyModule originalModule = (RubyModule)original;
if (!getMetaClass().isSingleton()) {
setMetaClass(originalModule.getSingletonClassCloneAndAttach(this));
}
setSuperClass(originalModule.getSuperClass());
if (originalModule.hasVariables()) syncVariables(originalModule);
syncConstants(originalModule);
originalModule.cloneMethods(this);
return this;
}
代码示例来源:origin: org.jruby/jruby-complete
setSuperClass(prep);
代码示例来源:origin: org.jruby/jruby-core
setSuperClass(prep);
内容来源于网络,如有侵权,请联系作者删除!