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

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

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

RubyModule.hasInternalVariable介绍

暂无

代码示例

代码示例来源: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 boolean hasInternalModuleVariable(final String name) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    if (module.hasInternalVariable(name)) return true;
  }
  return false;
}
/**

代码示例来源: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 boolean hasInternalModuleVariable(final String name) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    if (module.hasInternalVariable(name)) return true;
  }
  return false;
}
/**

代码示例来源: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 boolean hasInternalModuleVariable(final String name) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    if (module.hasInternalVariable(name)) return true;
  }
  return false;
}
/**

代码示例来源: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 boolean hasInternalModuleVariable(final String name) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    if (module.hasInternalVariable(name)) return true;
  }
  return false;
}
/**

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

/**
 * Behaves similarly to {@link #setClassVar(String, IRubyObject)}. If the
 * specified internal variable is found in this class/module <em>or an ancestor</em>,
 * it is set where found.  Otherwise it is set in this module.
 *
 * @param name the internal variable name
 * @param value the internal variable value
 * @see #searchInternalModuleVariable(String)
 */
public void setInternalModuleVariable(final String name, final IRubyObject value) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    if (module.hasInternalVariable(name)) {
      module.setInternalVariable(name, value);
      return;
    }
  }
  setInternalVariable(name, value);
}

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

/**
 * Behaves similarly to {@link #setClassVar(String, IRubyObject)}. If the
 * specified internal variable is found in this class/module <em>or an ancestor</em>,
 * it is set where found.  Otherwise it is set in this module.
 *
 * @param name the internal variable name
 * @param value the internal variable value
 * @see #searchInternalModuleVariable(String)
 */
public void setInternalModuleVariable(final String name, final IRubyObject value) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    if (module.hasInternalVariable(name)) {
      module.setInternalVariable(name, value);
      return;
    }
  }
  setInternalVariable(name, value);
}

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

/**
 * Behaves similarly to {@link #setClassVar(String, IRubyObject)}. If the
 * specified internal variable is found in this class/module <em>or an ancestor</em>,
 * it is set where found.  Otherwise it is set in this module. 
 * 
 * @param name the internal variable name
 * @param value the internal variable value
 * @see #searchInternalModuleVariable(String)
 */
public void setInternalModuleVariable(final String name, final IRubyObject value) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    if (module.hasInternalVariable(name)) {
      module.setInternalVariable(name, value);
      return;
    }
  }
  setInternalVariable(name, value);
}

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

/**
 * Behaves similarly to {@link #setClassVar(String, IRubyObject)}. If the
 * specified internal variable is found in this class/module <em>or an ancestor</em>,
 * it is set where found.  Otherwise it is set in this module. 
 * 
 * @param name the internal variable name
 * @param value the internal variable value
 * @see #searchInternalModuleVariable(String)
 */
public void setInternalModuleVariable(final String name, final IRubyObject value) {
  for (RubyModule module = this; module != null; module = module.getSuperClass()) {
    if (module.hasInternalVariable(name)) {
      module.setInternalVariable(name, value);
      return;
    }
  }
  setInternalVariable(name, value);
}

代码示例来源: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");
  }
}

代码示例来源: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-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.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");
  }
}

相关文章

微信公众号

最新文章

更多

RubyModule类方法