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

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

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

RubyModule.getAutoloadMap介绍

[英]AutoloadMap must be accessed after checking ConstantMap. Checking UNDEF value in constantMap works as a guard. For looking up constant, check constantMap first then try to get an Autoload object from autoloadMap. For setting constant, update constantMap first and remove an Autoload object from autoloadMap.
[中]必须在检查ConstantMap后访问AutolodMap。在constantMap中检查UNDEF值起到保护作用。要查找常量,请先检查constantMap,然后尝试从AutolodMap获取自动加载对象。要设置常量,请先更新constantMap,然后从AutolodMap中删除自动加载的对象。

代码示例

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

protected String getAutoloadFile(String name) {
  Autoload autoload = getAutoloadMap().get(name);
  if (autoload != null) {
    return autoload.getFile();
  }
  return null;
}

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

/**
 * Define an autoload. ConstantMap holds UNDEF for the name as an autoload marker.
 */
protected void defineAutoload(String name, IAutoloadMethod loadMethod) {
  Autoload existingAutoload = getAutoloadMap().get(name);
  if (existingAutoload == null || existingAutoload.getValue() == null) {
    storeConstant(name, RubyObject.UNDEF);
    getAutoloadMapForWrite().put(name, new Autoload(loadMethod));
  }
}

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

protected RubyString getAutoloadFile(String name) {
  final Autoload autoload = getAutoloadMap().get(name);
  return autoload == null ? null : autoload.getFile();
}

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

/**
 * Define an autoload. ConstantMap holds UNDEF for the name as an autoload marker.
 */
protected final void defineAutoload(String name, AutoloadMethod loadMethod) {
  final Autoload existingAutoload = getAutoloadMap().get(name);
  if (existingAutoload == null || existingAutoload.getValue() == null) {
    storeConstant(name, RubyObject.UNDEF);
    getAutoloadMapForWrite().put(name, new Autoload(loadMethod));
  }
}

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

protected String getAutoloadFile(String name) {
  Autoload autoload = getAutoloadMap().get(name);
  if (autoload != null) {
    return autoload.getFile();
  }
  return null;
}

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

/**
 * Define an autoload. ConstantMap holds UNDEF for the name as an autoload marker.
 */
protected final void defineAutoload(String name, AutoloadMethod loadMethod) {
  final Autoload existingAutoload = getAutoloadMap().get(name);
  if (existingAutoload == null || existingAutoload.getValue() == null) {
    storeConstant(name, RubyObject.UNDEF);
    getAutoloadMapForWrite().put(name, new Autoload(loadMethod));
  }
}

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

protected RubyString getAutoloadFile(String name) {
  final Autoload autoload = getAutoloadMap().get(name);
  return autoload == null ? null : autoload.getFile();
}

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

/**
 * Define an autoload. ConstantMap holds UNDEF for the name as an autoload marker.
 */
protected void defineAutoload(String name, IAutoloadMethod loadMethod) {
  Autoload existingAutoload = getAutoloadMap().get(name);
  if (existingAutoload == null || existingAutoload.getValue() == null) {
    storeConstant(name, RubyObject.UNDEF);
    getAutoloadMapForWrite().put(name, new Autoload(loadMethod));
  }
}

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

protected IRubyObject getAutoloadConstant(String name, boolean loadConstant) {
  final Autoload autoload = getAutoloadMap().get(name);
  if ( autoload == null ) return null;
  if ( ! loadConstant ) return RubyObject.UNDEF;
  return autoload.getConstant( getRuntime().getCurrentContext() );
}

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

protected IRubyObject getAutoloadConstant(String name, boolean loadConstant) {
  final Autoload autoload = getAutoloadMap().get(name);
  if ( autoload == null ) return null;
  if ( ! loadConstant ) return RubyObject.UNDEF;
  return autoload.getConstant( getRuntime().getCurrentContext() );
}

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

/**
 * Get autoload constant.
 * If it's first resolution for the constant, it tries to require the defined feature and returns the defined value.
 * Multi-threaded accesses are blocked and processed sequentially except if the caller is the autoloading thread.
 */
public IRubyObject getAutoloadConstant(String name) {
  Autoload autoload = getAutoloadMap().get(name);
  if (autoload == null) {
    return null;
  }
  return autoload.getConstant(getRuntime().getCurrentContext());
}

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

/**
 * Get autoload constant.
 * If it's first resolution for the constant, it tries to require the defined feature and returns the defined value.
 * Multi-threaded accesses are blocked and processed sequentially except if the caller is the autoloading thread.
 */
public IRubyObject getAutoloadConstant(String name) {
  Autoload autoload = getAutoloadMap().get(name);
  if (autoload == null) {
    return null;
  }
  return autoload.getConstant(getRuntime().getCurrentContext());
}

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

public boolean fastIsConstantDefined(String internedName) {
  assert internedName.equals(internedName.intern()) : internedName + " is not interned";
  assert IdUtil.isConstant(internedName);
  boolean isObject = this == getRuntime().getObject();
  RubyModule module = this;
  do {
    Object value;
    if ((value = module.constantTableFetch(internedName)) != null) {
      if (value != UNDEF) return true;
      return getAutoloadMap().get(internedName) != null;
    }
  } while (isObject && (module = module.getSuperClass()) != null );
  return false;
}

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

public boolean fastIsConstantDefined(String internedName) {
  assert internedName.equals(internedName.intern()) : internedName + " is not interned";
  assert IdUtil.isConstant(internedName);
  boolean isObject = this == getRuntime().getObject();
  RubyModule module = this;
  do {
    Object value;
    if ((value = module.constantTableFetch(internedName)) != null) {
      if (value != UNDEF) return true;
      return getAutoloadMap().get(internedName) != null;
    }
  } while (isObject && (module = module.getSuperClass()) != null );
  return false;
}

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

/**
 * Set an Object as a defined constant in autoloading.
 */
private boolean setAutoloadConstant(String name, IRubyObject value) {
  final Autoload autoload = getAutoloadMap().get(name);
  if ( autoload != null ) {
    boolean set = autoload.setConstant(getRuntime().getCurrentContext(), value);
    if ( ! set ) removeAutoload(name);
    return set;
  }
  return false;
}

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

/**
 * Set an Object as a defined constant in autoloading.
 */
private boolean setAutoloadConstant(String name, IRubyObject value) {
  final Autoload autoload = getAutoloadMap().get(name);
  if ( autoload != null ) {
    boolean set = autoload.setConstant(getRuntime().getCurrentContext(), value);
    if ( ! set ) removeAutoload(name);
    return set;
  }
  return false;
}

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

/**
 * Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
 */
protected final IRubyObject finishAutoload(String name) {
  final Autoload autoload = getAutoloadMap().get(name);
  if ( autoload == null ) return null;
  final IRubyObject value = autoload.getValue();
  if ( value != null ) {
    storeConstant(name, value);
  }
  removeAutoload(name);
  invalidateConstantCache(name);
  return value;
}

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

/**
 * Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
 */
protected final IRubyObject finishAutoload(String name) {
  final Autoload autoload = getAutoloadMap().get(name);
  if ( autoload == null ) return null;
  final IRubyObject value = autoload.getValue();
  if ( value != null ) {
    storeConstant(name, value);
  }
  removeAutoload(name);
  invalidateConstantCache(name);
  return value;
}

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

/**
 * Set an Object as a defined constant in autoloading.
 */
private void setAutoloadConstant(String name, IRubyObject value) {
  Autoload autoload = getAutoloadMap().get(name);
  if (autoload != null) {
    if (!autoload.setConstant(getRuntime().getCurrentContext(), value)) {
      storeConstant(name, value);
      removeAutoload(name);
    }
  } else {
    storeConstant(name, value);
  }
}

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

/**
 * Set an Object as a defined constant in autoloading.
 */
private void setAutoloadConstant(String name, IRubyObject value) {
  Autoload autoload = getAutoloadMap().get(name);
  if (autoload != null) {
    if (!autoload.setConstant(getRuntime().getCurrentContext(), value)) {
      storeConstant(name, value);
      removeAutoload(name);
    }
  } else {
    storeConstant(name, value);
  }
}

相关文章

微信公众号

最新文章

更多

RubyModule类方法