org.eclipse.core.internal.runtime.AdapterManager.addFactoriesFor()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(84)

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

AdapterManager.addFactoriesFor介绍

[英]Given a type name, add all of the factories that respond to those types into the given table. Each entry will be keyed by the adapter class name (supplied in IAdapterFactory.getAdapterList).
[中]给定类型名称,将响应这些类型的所有工厂添加到给定表中。每个条目都将由适配器类名(在IAdapterFactory.getAdapterList中提供)键入。

代码示例

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.common

/**
 * Computes the adapters that the provided class can adapt to, along
 * with the factory object that can perform that transformation. Returns 
 * a table of adapter class name to factory object.
 * @param adaptable
 */
private Map<String, IAdapterFactory> getFactories(Class<? extends Object> adaptable) {
  //cache reference to lookup to protect against concurrent flush
  Map<String, Map<String, IAdapterFactory>> lookup = adapterLookup;
  if (lookup == null)
    adapterLookup = lookup = Collections.synchronizedMap(new HashMap<String, Map<String, IAdapterFactory>>(30));
  Map<String, IAdapterFactory> table = lookup.get(adaptable.getName());
  if (table == null) {
    // calculate adapters for the class
    table = new HashMap<String, IAdapterFactory>(4);
    Class<?>[] classes = computeClassOrder(adaptable);
    for (int i = 0; i < classes.length; i++)
      addFactoriesFor(classes[i].getName(), table);
    // cache the table
    lookup.put(adaptable.getName(), table);
  }
  return table;
}

代码示例来源:origin: org.eclipse.equinox/common

/**
 * Computes the adapters that the provided class can adapt to, along
 * with the factory object that can perform that transformation. Returns 
 * a table of adapter class name to factory object.
 * @param adaptable
 */
private Map getFactories(Class adaptable) {
  //cache reference to lookup to protect against concurrent flush
  Map lookup = adapterLookup;
  if (lookup == null)
    adapterLookup = lookup = Collections.synchronizedMap(new HashMap(30));
  Map table = (Map) lookup.get(adaptable.getName());
  if (table == null) {
    // calculate adapters for the class
    table = new HashMap(4);
    Class[] classes = computeClassOrder(adaptable);
    for (int i = 0; i < classes.length; i++)
      addFactoriesFor(classes[i].getName(), table);
    // cache the table
    lookup.put(adaptable.getName(), table);
  }
  return table;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.equinox.common

/**
 * Computes the adapters that the provided class can adapt to, along
 * with the factory object that can perform that transformation. Returns 
 * a table of adapter class name to factory object.
 */
private Map<String, IAdapterFactory> getFactories(Class<? extends Object> adaptable) {
  //cache reference to lookup to protect against concurrent flush
  Map<String, Map<String, IAdapterFactory>> lookup = adapterLookup;
  if (lookup == null)
    adapterLookup = lookup = Collections.synchronizedMap(new HashMap<String, Map<String, IAdapterFactory>>(30));
  Map<String, IAdapterFactory> table = lookup.get(adaptable.getName());
  if (table == null) {
    // calculate adapters for the class
    table = new HashMap<>(4);
    Class<?>[] classes = computeClassOrder(adaptable);
    for (int i = 0; i < classes.length; i++)
      addFactoriesFor(classes[i].getName(), table);
    // cache the table
    lookup.put(adaptable.getName(), table);
  }
  return table;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.equinox.common

/**
 * Computes the adapters that the provided class can adapt to, along
 * with the factory object that can perform that transformation. Returns 
 * a table of adapter class name to factory object.
 * @param adaptable
 */
private Map getFactories(Class adaptable) {
  //cache reference to lookup to protect against concurrent flush
  Map lookup = adapterLookup;
  if (lookup == null)
    adapterLookup = lookup = Collections.synchronizedMap(new HashMap(30));
  Map table = (Map) lookup.get(adaptable.getName());
  if (table == null) {
    // calculate adapters for the class
    table = new HashMap(4);
    Class[] classes = computeClassOrder(adaptable);
    for (int i = 0; i < classes.length; i++)
      addFactoriesFor(classes[i].getName(), table);
    // cache the table
    lookup.put(adaptable.getName(), table);
  }
  return table;
}

相关文章