org.jruby.RubyModule.getInstanceVariables()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(78)

本文整理了Java中org.jruby.RubyModule.getInstanceVariables方法的一些代码示例,展示了RubyModule.getInstanceVariables的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.getInstanceVariables方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:getInstanceVariables

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);
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多

RubyModule类方法