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

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

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

RubyModule.resolveUndefConstant介绍

暂无

代码示例

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

public IRubyObject getConstantAt(String name, boolean includePrivate) {
  IRubyObject value = fetchConstant(name, includePrivate);
  return value == UNDEF ? resolveUndefConstant(name) : value;
}

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

public IRubyObject getConstantAt(String name, boolean includePrivate) {
  IRubyObject value = fetchConstant(name, includePrivate);
  return value == UNDEF ? resolveUndefConstant(name) : value;
}

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

public IRubyObject getConstantAt(String name, boolean includePrivate) {
  IRubyObject value = fetchConstant(name, includePrivate);
  return value == UNDEF ? resolveUndefConstant(name) : value;
}

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

public IRubyObject getConstantAt(String name, boolean includePrivate) {
  IRubyObject value = fetchConstant(name, includePrivate);
  return value == UNDEF ? resolveUndefConstant(name) : value;
}

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

public IRubyObject getConstantInner(String internedName) {
  IRubyObject result = cref.fetchConstant(internedName);
  if (result != null) {
    return result == RubyObject.UNDEF ? cref.resolveUndefConstant(internedName) : result;
  }
  return previousCRefScope == null ? null : previousCRefScope.getConstantInnerNoObject(internedName);
}

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

public IRubyObject getConstantInner(String internedName) {
  IRubyObject result = cref.fetchConstant(internedName);
  if (result != null) {
    return result == RubyObject.UNDEF ? cref.resolveUndefConstant(internedName) : result;
  }
  return previousCRefScope == null ? null : previousCRefScope.getConstantInnerNoObject(internedName);
}

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

public IRubyObject getConstantInner(String internedName) {
  IRubyObject result = cref.fetchConstant(internedName);
  if (result != null) {
    return result == RubyObject.UNDEF ? cref.resolveUndefConstant(internedName) : result;
  }
  return previousCRefScope == null ? null : previousCRefScope.getConstantInnerNoObject(internedName);
}

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

public IRubyObject getConstantInner(String internedName) {
  IRubyObject result = cref.fetchConstant(internedName);
  if (result != null) {
    return result == RubyObject.UNDEF ? cref.resolveUndefConstant(internedName) : result;
  }
  return previousCRefScope == null ? null : previousCRefScope.getConstantInnerNoObject(internedName);
}

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

/**
 * This version searches superclasses if we're starting with Object. This
 * corresponds to logic in rb_const_defined_0 that recurses for Object only.
 *
 * @param name the constant name to find
 * @return the constant, or null if it was not found
 */
public IRubyObject getConstantAtSpecial(String name) {
  IRubyObject value;
  if (this == getRuntime().getObject()) {
    value = getConstantNoConstMissing(name);
  } else {
    value = fetchConstant(name);
  }
  return value == UNDEF ? resolveUndefConstant(name) : value;
}

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

public IRubyObject getConstantFromNoConstMissing(String name, boolean includePrivate) {
  final Ruby runtime = getRuntime();
  final RubyClass objectClass = runtime.getObject();
  RubyModule mod = this; IRubyObject value;
  while ( mod != null ) {
    if ( ( value = mod.fetchConstant(name, includePrivate) ) != null ) {
      if ( value == UNDEF ) return mod.resolveUndefConstant(name);
      if ( mod == objectClass && this != objectClass ) {
        return null;
      }
      return value;
    }
    mod = mod.getSuperClass();
  }
  return null;
}

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

/**
 * This version searches superclasses if we're starting with Object. This
 * corresponds to logic in rb_const_defined_0 that recurses for Object only.
 *
 * @param name the constant name to find
 * @return the constant, or null if it was not found
 */
public IRubyObject getConstantAtSpecial(String name) {
  IRubyObject value;
  if (this == getRuntime().getObject()) {
    value = getConstantNoConstMissing(name);
  } else {
    value = fetchConstant(name);
  }
  
  return value == UNDEF ? resolveUndefConstant(name) : value;
}

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

/**
 * This version searches superclasses if we're starting with Object. This
 * corresponds to logic in rb_const_defined_0 that recurses for Object only.
 *
 * @param name the constant name to find
 * @return the constant, or null if it was not found
 */
public IRubyObject getConstantAtSpecial(String name) {
  IRubyObject value;
  if (this == getRuntime().getObject()) {
    value = getConstantNoConstMissing(name);
  } else {
    value = fetchConstant(name);
  }
  
  return value == UNDEF ? resolveUndefConstant(name) : value;
}

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

/**
 * This version searches superclasses if we're starting with Object. This
 * corresponds to logic in rb_const_defined_0 that recurses for Object only.
 *
 * @param name the constant name to find
 * @return the constant, or null if it was not found
 */
public IRubyObject getConstantAtSpecial(String name) {
  IRubyObject value;
  if (this == getRuntime().getObject()) {
    value = getConstantNoConstMissing(name);
  } else {
    value = fetchConstant(name);
  }
  return value == UNDEF ? resolveUndefConstant(name) : value;
}

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

public IRubyObject getConstantFromNoConstMissing(String name, boolean includePrivate) {
  final Ruby runtime = getRuntime();
  final RubyClass objectClass = runtime.getObject();
  RubyModule mod = this; IRubyObject value;
  while ( mod != null ) {
    if ( ( value = mod.fetchConstant(name, includePrivate) ) != null ) {
      if ( value == UNDEF ) return mod.resolveUndefConstant(name);
      if ( mod == objectClass && this != objectClass ) {
        return null;
      }
      return value;
    }
    mod = mod.getSuperClass();
  }
  return null;
}

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

public IRubyObject getConstantFromNoConstMissing(String name, boolean includePrivate) {
  assert name == name.intern() : name + " is not interned";
  assert IdUtil.isConstant(name);
  Ruby runtime = getRuntime();
  RubyClass objectClass = runtime.getObject();
  IRubyObject value;
  RubyModule p = this;
  while (p != null) {
    if ((value = p.fetchConstant(name, false)) != null) {
      if (value == UNDEF) {
        return p.resolveUndefConstant(name);
      }
      if (p == objectClass && this != objectClass) {
        String badCName = getName() + "::" + name;
        runtime.getWarnings().warn(ID.CONSTANT_BAD_REFERENCE, "toplevel constant " +
            name + " referenced by " + badCName);
      }
      return value;
    }
    p = p.getSuperClass();
  }
  return null;
}

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

public IRubyObject getConstantFromNoConstMissing(String name, boolean includePrivate) {
  assert name == name.intern() : name + " is not interned";
  assert IdUtil.isConstant(name);
  Ruby runtime = getRuntime();
  RubyClass objectClass = runtime.getObject();
  IRubyObject value;
  RubyModule p = this;
  while (p != null) {
    if ((value = p.fetchConstant(name, false)) != null) {
      if (value == UNDEF) {
        return p.resolveUndefConstant(name);
      }
      if (p == objectClass && this != objectClass) {
        String badCName = getName() + "::" + name;
        runtime.getWarnings().warn(ID.CONSTANT_BAD_REFERENCE, "toplevel constant " +
            name + " referenced by " + badCName);
      }
      return value;
    }
    p = p.getSuperClass();
  }
  return null;
}

相关文章

微信公众号

最新文章

更多

RubyModule类方法