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

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

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

RubyModule.getInternalVariable介绍

暂无

代码示例

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

private Metadata getMetadata(RubyModule type) {
  for (RubyModule current = type; current != null; current = current.getSuperClass()) {
    Metadata metadata = (Metadata) current.getInternalVariable("metadata");
    if (metadata != null) return metadata;
  }
  return null;
}

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

private Metadata getMetadata(RubyModule type) {
  for (RubyModule current = type; current != null; current = current.getSuperClass()) {
    Metadata metadata = (Metadata) current.getInternalVariable("metadata");
    if (metadata != null) return metadata;
  }
  return null;
}

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

private Metadata getMetadata(RubyModule type) {
  for (RubyModule current = type; current != null; current = current.getSuperClass()) {
    Metadata metadata = (Metadata) current.getInternalVariable("metadata");
    if (metadata != null) return metadata;
  }
  return null;
}

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

private Metadata getMetadata(RubyModule type) {
  for (RubyModule current = type; current != null; current = current.getSuperClass()) {
    Metadata metadata = (Metadata) current.getInternalVariable("metadata");
    if (metadata != null) return metadata;
  }
  return null;
}

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

/**
 * Behaves similarly to {@link #getClassVar(String)}. Searches this
 * class/module <em>and its ancestors</em> for the specified internal
 * variable.
 * 
 * @param name the internal variable name
 * @return the value of the specified internal variable if found, else null
 * @see #setInternalModuleVariable(String, IRubyObject)
 */
public IRubyObject searchInternalModuleVariable(final String name) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    IRubyObject value = (IRubyObject)module.getInternalVariable(name);
    if (value != null) return value;
  }
  return null;
}

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

/**
 * Behaves similarly to {@link #getClassVar(String)}. Searches this
 * class/module <em>and its ancestors</em> for the specified internal
 * variable.
 * 
 * @param name the internal variable name
 * @return the value of the specified internal variable if found, else null
 * @see #setInternalModuleVariable(String, IRubyObject)
 */
public IRubyObject searchInternalModuleVariable(final String name) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    IRubyObject value = (IRubyObject)module.getInternalVariable(name);
    if (value != null) return value;
  }
  return null;
}

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

/**
 * Behaves similarly to {@link #getClassVar(String)}. Searches this
 * class/module <em>and its ancestors</em> for the specified internal
 * variable.
 *
 * @param name the internal variable name
 * @return the value of the specified internal variable if found, else null
 * @see #setInternalModuleVariable(String, IRubyObject)
 */
public IRubyObject searchInternalModuleVariable(final String name) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    IRubyObject value = (IRubyObject)module.getInternalVariable(name);
    if (value != null) return value;
  }
  return null;
}

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

/**
 * Behaves similarly to {@link #getClassVar(String)}. Searches this
 * class/module <em>and its ancestors</em> for the specified internal
 * variable.
 *
 * @param name the internal variable name
 * @return the value of the specified internal variable if found, else null
 * @see #setInternalModuleVariable(String, IRubyObject)
 */
public IRubyObject searchInternalModuleVariable(final String name) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    IRubyObject value = (IRubyObject)module.getInternalVariable(name);
    if (value != null) return value;
  }
  return null;
}

代码示例来源:origin: headius/jo

@JRubyMethod(module = true)
public static IRubyObject jo(ThreadContext context, IRubyObject self, Block block) {
  Ruby runtime = context.runtime;
  RubyModule jo = runtime.getModule("Jo");
  ExecutorService executor = (ExecutorService)jo.getInternalVariable("executor");
  Future<IRubyObject> future = executor.submit(new JoRoutine(runtime, block));
  return new JoFuture(runtime, jo.getClass("Future"), future);
}

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

@JRubyMethod(name = "reference_required?", module=true)
public static IRubyObject reference_required_p(ThreadContext context, IRubyObject self) {
  Object ref = module(self).getInternalVariable("reference_required");
  return context.runtime.newBoolean(!(ref instanceof IRubyObject) || ((IRubyObject) ref).isTrue());
}

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

@JRubyMethod(name = "reference_required?", module=true)
public static IRubyObject reference_required_p(ThreadContext context, IRubyObject self) {
  Object ref = module(self).getInternalVariable("reference_required");
  return context.runtime.newBoolean(!(ref instanceof IRubyObject) || ((IRubyObject) ref).isTrue());
}

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

@JRubyMethod(name = "reference_required?", module=true)
public static IRubyObject reference_required_p(ThreadContext context, IRubyObject self) {
  Object ref = module(self).getInternalVariable("reference_required");
  return context.runtime.newBoolean(!(ref instanceof IRubyObject) || ((IRubyObject) ref).isTrue());
}

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

@JRubyMethod(name = "reference_required?", module=true)
public static IRubyObject reference_required_p(ThreadContext context, IRubyObject self) {
  Object ref = module(self).getInternalVariable("reference_required");
  return context.runtime.newBoolean(!(ref instanceof IRubyObject) || ((IRubyObject) ref).isTrue());
}

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

@JRubyMethod(name = "native_type", module=true, optional = 1)
public static IRubyObject native_type(ThreadContext context, IRubyObject self, IRubyObject[] args) {
  RubyModule m = module(self);
  if (args.length == 0) {
    if (!m.hasInternalVariable("native_type")) {
      throw context.runtime.newNotImplementedError("native_type method not overridden and no native_type set");
    }
    return (Type) m.getInternalVariable("native_type");
  } else if (args.length == 1) {
    Type type = Util.findType(context, args[0]);
    m.setInternalVariable("native_type", type);
    return type;
  } else {
    throw context.runtime.newArgumentError("incorrect arguments");
  }
}

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

@JRubyMethod(name = "native_type", module=true, optional = 1)
public static IRubyObject native_type(ThreadContext context, IRubyObject self, IRubyObject[] args) {
  RubyModule m = module(self);
  if (args.length == 0) {
    if (!m.hasInternalVariable("native_type")) {
      throw context.runtime.newNotImplementedError("native_type method not overridden and no native_type set");
    }
    return (Type) m.getInternalVariable("native_type");
  } else if (args.length == 1) {
    Type type = Util.findType(context, args[0]);
    m.setInternalVariable("native_type", type);
    return type;
  } else {
    throw context.runtime.newArgumentError("incorrect arguments");
  }
}

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

Collection<String> methodNames = (Collection<String>) ancestor.getInternalVariable("__java_ovrd_methods");

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

@JRubyMethod(name = "native_type", module=true, optional = 1)
public static IRubyObject native_type(ThreadContext context, IRubyObject self, IRubyObject[] args) {
  RubyModule m = module(self);
  if (args.length == 0) {
    if (!m.hasInternalVariable("native_type")) {
      throw context.runtime.newNotImplementedError("native_type method not overridden and no native_type set");
    }
    return (Type) m.getInternalVariable("native_type");
  } else if (args.length == 1) {
    Type type = Util.findType(context, args[0]);
    m.setInternalVariable("native_type", type);
    return type;
  } else {
    throw context.runtime.newArgumentError("incorrect arguments");
  }
}

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

Collection<String> methodNames = (Collection<String>) ancestor.getInternalVariable("__java_ovrd_methods");

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

@JRubyMethod(name = "native_type", module=true, optional = 1)
public static IRubyObject native_type(ThreadContext context, IRubyObject self, IRubyObject[] args) {
  RubyModule m = module(self);
  if (args.length == 0) {
    if (!m.hasInternalVariable("native_type")) {
      throw context.runtime.newNotImplementedError("native_type method not overridden and no native_type set");
    }
    return (Type) m.getInternalVariable("native_type");
  } else if (args.length == 1) {
    Type type = Util.findType(context, args[0]);
    m.setInternalVariable("native_type", type);
    return type;
  } else {
    throw context.runtime.newArgumentError("incorrect arguments");
  }
}

相关文章

微信公众号

最新文章

更多

RubyModule类方法