本文整理了Java中org.jruby.RubyModule.getInstanceVariables
方法的一些代码示例,展示了RubyModule.getInstanceVariables
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.getInstanceVariables
方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:getInstanceVariables
暂无
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
if (module.getInstanceVariables().hasInstanceVariable("@java_class") &&
module.getInstanceVariables().getInstanceVariable("@java_class").isTrue()) {
throw runtime.newTypeError("can not add Java interface to existing Java interface");
if (!module.getInstanceVariables().hasInstanceVariable("@java_interface_mods")) {
RubyArray javaInterfaceMods = RubyArray.newArray(runtime, self);
module.getInstanceVariables().setInstanceVariable("@java_interface_mods", javaInterfaceMods);
RubyClass singleton = module.getSingletonClass();
} else {
RubyArray javaInterfaceMods =(RubyArray)module.getInstanceVariables().getInstanceVariable("@java_interface_mods");
if (!javaInterfaceMods.includes(context, self)) {
javaInterfaceMods.append(self);
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
if (module.getInstanceVariables().hasInstanceVariable("@java_class") &&
module.getInstanceVariables().getInstanceVariable("@java_class").isTrue()) {
throw runtime.newTypeError("can not add Java interface to existing Java interface");
if (!module.getInstanceVariables().hasInstanceVariable("@java_interface_mods")) {
RubyArray javaInterfaceMods = RubyArray.newArray(runtime, self);
module.getInstanceVariables().setInstanceVariable("@java_interface_mods", javaInterfaceMods);
RubyClass singleton = module.getSingletonClass();
} else {
RubyArray javaInterfaceMods =(RubyArray)module.getInstanceVariables().getInstanceVariable("@java_interface_mods");
if (!javaInterfaceMods.includes(context, self)) {
javaInterfaceMods.append(self);
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public RubyModule defineModuleUnder(RubyModule pkg, String name) {
IRubyObject packageName;
// again, shouldn't happen. TODO: might want to throw exception instead.
if ((packageName = pkg.getInstanceVariables().getInstanceVariable("@package_name")) == null) {
return null;
}
Ruby runtime = pkg.getRuntime();
return (RubyModule) get_interface_module(
runtime,
JavaClass.forNameVerbose(runtime, packageName.asJavaString() + name));
}
};
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public RubyModule defineModuleUnder(RubyModule pkg, String name) {
IRubyObject packageName;
// again, shouldn't happen. TODO: might want to throw exception instead.
if ((packageName = pkg.getInstanceVariables().getInstanceVariable("@package_name")) == null) {
return null;
}
Ruby runtime = pkg.getRuntime();
return (RubyModule) get_interface_module(
runtime,
JavaClass.forNameVerbose(runtime, packageName.asJavaString() + name));
}
};
代码示例来源:origin: org.jruby/jruby-complete
if (!ancestor.getInstanceVariables().hasInstanceVariable("@java_proxy_class")) {
skipRemainingClasses = true;
continue;
IRubyObject var = ancestor.getInstanceVariables().getInstanceVariable("@java_class");
if ( ! (var instanceof JavaClass) ) {
if (var == null) {
var = ancestor.getInstanceVariables().getInstanceVariable("@java_interfaces");
if (var != null && !(var instanceof RubyNil)) {
if (!(var instanceof RubyArray)) {
代码示例来源:origin: org.jruby/jruby-core
if (!ancestor.getInstanceVariables().hasInstanceVariable("@java_proxy_class")) {
skipRemainingClasses = true;
continue;
IRubyObject var = ancestor.getInstanceVariables().getInstanceVariable("@java_class");
if ( ! (var instanceof JavaClass) ) {
if (var == null) {
var = ancestor.getInstanceVariables().getInstanceVariable("@java_interfaces");
if (var != null && !(var instanceof RubyNil)) {
if (!(var instanceof RubyArray)) {
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public RubyClass defineClassUnder(RubyModule pkg, String name, RubyClass superClazz) {
// shouldn't happen, but if a superclass is specified, it's not ours
if (superClazz != null) {
return null;
}
IRubyObject packageName;
// again, shouldn't happen. TODO: might want to throw exception instead.
if ((packageName = pkg.getInstanceVariables().getInstanceVariable("@package_name")) == null) {
return null;
}
Ruby runtime = pkg.getRuntime();
return (RubyClass) get_proxy_class(
runtime.getJavaSupport().getJavaUtilitiesModule(),
JavaClass.forNameVerbose(runtime, packageName.asJavaString() + name));
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public RubyClass defineClassUnder(RubyModule pkg, String name, RubyClass superClazz) {
// shouldn't happen, but if a superclass is specified, it's not ours
if (superClazz != null) {
return null;
}
IRubyObject packageName;
// again, shouldn't happen. TODO: might want to throw exception instead.
if ((packageName = pkg.getInstanceVariables().getInstanceVariable("@package_name")) == null) {
return null;
}
Ruby runtime = pkg.getRuntime();
return (RubyClass) get_proxy_class(
runtime.getJavaSupport().getJavaUtilitiesModule(),
JavaClass.forNameVerbose(runtime, packageName.asJavaString() + name));
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
if (!ancestor.getInstanceVariables().hasInstanceVariable("@java_proxy_class")) {
skipRemainingClasses = true;
continue;
IRubyObject var = ancestor.getInstanceVariables().getInstanceVariable("@java_class");
if (var == null) {
throw runtime.newTypeError(
var = ancestor.getInstanceVariables().getInstanceVariable("@java_interfaces");
if (var != null && !(var instanceof RubyNil)) {
if (!(var instanceof RubyArray)) {
var = ancestor.getInstanceVariables().getInstanceVariable("@__java_ovrd_methods");
if (var == null) {
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
if (!ancestor.getInstanceVariables().hasInstanceVariable("@java_proxy_class")) {
skipRemainingClasses = true;
continue;
IRubyObject var = ancestor.getInstanceVariables().getInstanceVariable("@java_class");
if (var == null) {
throw runtime.newTypeError(
var = ancestor.getInstanceVariables().getInstanceVariable("@java_interfaces");
if (var != null && !(var instanceof RubyNil)) {
if (!(var instanceof RubyArray)) {
var = ancestor.getInstanceVariables().getInstanceVariable("@__java_ovrd_methods");
if (var == null) {
代码示例来源:origin: org.jruby/jruby-core
private static void appendFeaturesToModule(ThreadContext context, final IRubyObject self, final RubyModule module) {
// assuming the user wants a collection of interfaces that can be
// included together. make it so.
final Ruby runtime = context.runtime;
final IRubyObject java_class = module.getInstanceVariables().getInstanceVariable("@java_class");
// not allowed for existing Java interface modules
if (java_class != null && java_class.isTrue()) {
throw runtime.newTypeError("can not add Java interface to existing Java interface");
}
// To turn a module into an "interface collection" we add a class instance
// variable to hold the list of interfaces, and modify append_features
// for this module to call append_features on each of those interfaces as
// well
synchronized (module) {
if ( initInterfaceModules(self, module) ) { // true - initialized
final RubyClass singleton = module.getSingletonClass();
singleton.addMethod("append_features", new AppendFeatures(singleton));
}
else {
// already set up append_features, just add the interface if we haven't already
final RubyArray interfaceModules = getInterfaceModules(module);
if ( ! interfaceModules.includes(context, self) ) {
interfaceModules.append(self);
}
}
}
}
代码示例来源:origin: org.jruby/jruby-complete
private static void appendFeaturesToModule(ThreadContext context, final IRubyObject self, final RubyModule module) {
// assuming the user wants a collection of interfaces that can be
// included together. make it so.
final Ruby runtime = context.runtime;
final IRubyObject java_class = module.getInstanceVariables().getInstanceVariable("@java_class");
// not allowed for existing Java interface modules
if (java_class != null && java_class.isTrue()) {
throw runtime.newTypeError("can not add Java interface to existing Java interface");
}
// To turn a module into an "interface collection" we add a class instance
// variable to hold the list of interfaces, and modify append_features
// for this module to call append_features on each of those interfaces as
// well
synchronized (module) {
if ( initInterfaceModules(self, module) ) { // true - initialized
final RubyClass singleton = module.getSingletonClass();
singleton.addMethod("append_features", new AppendFeatures(singleton));
}
else {
// already set up append_features, just add the interface if we haven't already
final RubyArray interfaceModules = getInterfaceModules(module);
if ( ! interfaceModules.includes(context, self) ) {
interfaceModules.append(self);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!