org.jruby.RubyClass.hasInstanceVariable()方法的使用及代码示例

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

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

RubyClass.hasInstanceVariable介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

private static void checkAlreadyReified(final RubyClass clazz, Ruby runtime) throws RaiseException {
  // not allowed for original (non-generated) Java classes
  // note: not allowing for any previously created class right now;
  // this restriction might be loosened later for generated classes
  if ( ( Java.NEW_STYLE_EXTENSION && clazz.getReifiedClass() != null )
      ||
      ( clazz.hasInstanceVariable("@java_class")
        && clazz.getInstanceVariable("@java_class").isTrue()
        && !clazz.getSingletonClass().isMethodBound("java_proxy_class", false) )
      ||
      ( clazz.hasInstanceVariable("@java_proxy_class")
        && clazz.getInstanceVariable("@java_proxy_class").isTrue() ) ) {
    throw runtime.newArgumentError("can not add Java interface to existing Java class");
  }
}

代码示例来源:origin: org.jruby/jruby-core

private static void checkAlreadyReified(final RubyClass clazz, Ruby runtime) throws RaiseException {
  // not allowed for original (non-generated) Java classes
  // note: not allowing for any previously created class right now;
  // this restriction might be loosened later for generated classes
  if ( ( Java.NEW_STYLE_EXTENSION && clazz.getReifiedClass() != null )
      ||
      ( clazz.hasInstanceVariable("@java_class")
        && clazz.getInstanceVariable("@java_class").isTrue()
        && !clazz.getSingletonClass().isMethodBound("java_proxy_class", false) )
      ||
      ( clazz.hasInstanceVariable("@java_proxy_class")
        && clazz.getInstanceVariable("@java_proxy_class").isTrue() ) ) {
    throw runtime.newArgumentError("can not add Java interface to existing Java class");
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private static void checkAlreadyReified(final RubyClass clazz, Ruby runtime) throws RaiseException {
  // not allowed for original (non-generated) Java classes
  // note: not allowing for any previously created class right now;
  // this restriction might be loosened later for generated classes
  if ((Java.NEW_STYLE_EXTENSION && clazz.getReifiedClass() != null)
      ||
      (clazz.hasInstanceVariable("@java_class")
        && clazz.getInstanceVariable("@java_class").isTrue()
        && !clazz.getSingletonClass().isMethodBound("java_proxy_class", false))
      ||
      (clazz.hasInstanceVariable("@java_proxy_class")
        && clazz.getInstanceVariable("@java_proxy_class").isTrue())) {
    throw runtime.newArgumentError("can not add Java interface to existing Java class");
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static void checkAlreadyReified(final RubyClass clazz, Ruby runtime) throws RaiseException {
  // not allowed for original (non-generated) Java classes
  // note: not allowing for any previously created class right now;
  // this restriction might be loosened later for generated classes
  if ((Java.NEW_STYLE_EXTENSION && clazz.getReifiedClass() != null)
      ||
      (clazz.hasInstanceVariable("@java_class")
        && clazz.getInstanceVariable("@java_class").isTrue()
        && !clazz.getSingletonClass().isMethodBound("java_proxy_class", false))
      ||
      (clazz.hasInstanceVariable("@java_proxy_class")
        && clazz.getInstanceVariable("@java_proxy_class").isTrue())) {
    throw runtime.newArgumentError("can not add Java interface to existing Java class");
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private static void appendFeaturesToClass(ThreadContext context, IRubyObject self, final RubyClass clazz) {
  Ruby runtime = context.runtime;
  checkAlreadyReified(clazz, runtime);
  IRubyObject javaClassObj = Helpers.getInstanceVariable(self, runtime, "@java_class");
  IRubyObject javaInterfaces;
  if (!clazz.hasInstanceVariable("@java_interfaces")) {
    javaInterfaces = RubyArray.newArray(runtime, javaClassObj);
    Helpers.setInstanceVariable(javaInterfaces, clazz, "@java_interfaces");
    initInterfaceImplMethods(context, clazz);
  } else {
    javaInterfaces = Helpers.getInstanceVariable(clazz, runtime, "@java_interfaces");
    // we've already done the above priming logic, just add another interface
    // to the list of intentions unless we're past the point of no return or
    // already intend to implement the given interface
    if (!(javaInterfaces.isFrozen() || ((RubyArray)javaInterfaces).includes(context, javaClassObj))) {
      ((RubyArray)javaInterfaces).append(javaClassObj);
    }
  }
}

代码示例来源:origin: org.jruby/jruby-complete

private static void appendFeaturesToClass(ThreadContext context, final IRubyObject self, final RubyClass clazz) {
  final Ruby runtime = context.runtime;
  checkAlreadyReified(clazz, runtime);
  final JavaClass javaClass = getJavaClassForInterface(self);
  RubyArray javaInterfaces;
  if ( ! clazz.hasInstanceVariable("@java_interfaces") ) {
    javaInterfaces = RubyArray.newArray(runtime, javaClass);
    clazz.setInstanceVariable("@java_interfaces", javaInterfaces);
    initInterfaceImplMethods(context, clazz);
  }
  else {
    javaInterfaces = (RubyArray) clazz.getInstanceVariable("@java_interfaces");
    // we've already done the above priming logic, just add another interface
    // to the list of intentions unless we're past the point of no return or
    // already intend to implement the given interface
    if ( ! ( javaInterfaces.isFrozen() || javaInterfaces.includes(context, javaClass) ) ) {
      javaInterfaces.append(javaClass);
    }
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static void appendFeaturesToClass(ThreadContext context, IRubyObject self, final RubyClass clazz) {
  Ruby runtime = context.runtime;
  checkAlreadyReified(clazz, runtime);
  IRubyObject javaClassObj = Helpers.getInstanceVariable(self, runtime, "@java_class");
  IRubyObject javaInterfaces;
  if (!clazz.hasInstanceVariable("@java_interfaces")) {
    javaInterfaces = RubyArray.newArray(runtime, javaClassObj);
    Helpers.setInstanceVariable(javaInterfaces, clazz, "@java_interfaces");
    initInterfaceImplMethods(context, clazz);
  } else {
    javaInterfaces = Helpers.getInstanceVariable(clazz, runtime, "@java_interfaces");
    // we've already done the above priming logic, just add another interface
    // to the list of intentions unless we're past the point of no return or
    // already intend to implement the given interface
    if (!(javaInterfaces.isFrozen() || ((RubyArray)javaInterfaces).includes(context, javaClassObj))) {
      ((RubyArray)javaInterfaces).append(javaClassObj);
    }
  }
}

代码示例来源:origin: org.jruby/jruby-core

private static void appendFeaturesToClass(ThreadContext context, final IRubyObject self, final RubyClass clazz) {
  final Ruby runtime = context.runtime;
  checkAlreadyReified(clazz, runtime);
  final JavaClass javaClass = getJavaClassForInterface(self);
  RubyArray javaInterfaces;
  if ( ! clazz.hasInstanceVariable("@java_interfaces") ) {
    javaInterfaces = RubyArray.newArray(runtime, javaClass);
    clazz.setInstanceVariable("@java_interfaces", javaInterfaces);
    initInterfaceImplMethods(context, clazz);
  }
  else {
    javaInterfaces = (RubyArray) clazz.getInstanceVariable("@java_interfaces");
    // we've already done the above priming logic, just add another interface
    // to the list of intentions unless we're past the point of no return or
    // already intend to implement the given interface
    if ( ! ( javaInterfaces.isFrozen() || javaInterfaces.includes(context, javaClass) ) ) {
      javaInterfaces.append(javaClass);
    }
  }
}

代码示例来源:origin: org.jruby/jruby-complete

if ( ( ! Java.NEW_STYLE_EXTENSION && clazz.getSuperClass().getRealClass().hasInstanceVariable("@java_class") )
  || RubyInstanceConfig.INTERFACES_USE_PROXY ) {

代码示例来源:origin: org.jruby/jruby-core

if ( ( ! Java.NEW_STYLE_EXTENSION && clazz.getSuperClass().getRealClass().hasInstanceVariable("@java_class") )
  || RubyInstanceConfig.INTERFACES_USE_PROXY ) {

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

(!Java.NEW_STYLE_EXTENSION && clazz.getSuperClass().getRealClass().hasInstanceVariable("@java_class"))
|| RubyInstanceConfig.INTERFACES_USE_PROXY) {

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

(!Java.NEW_STYLE_EXTENSION && clazz.getSuperClass().getRealClass().hasInstanceVariable("@java_class"))
|| RubyInstanceConfig.INTERFACES_USE_PROXY) {

相关文章

微信公众号

最新文章

更多

RubyClass类方法