org.reflections.Store.getOrCreate()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(92)

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

Store.getOrCreate介绍

[英]get or create the multimap object for the given index
[中]获取或创建给定索引的多重映射对象

代码示例

代码示例来源:origin: ronmamo/reflections

/**
 * merges a Reflections instance metadata into this instance
 */
public Reflections merge(final Reflections reflections) {
  if (reflections.store != null) {
    for (String indexName : reflections.store.keySet()) {
      Multimap<String, String> index = reflections.store.get(indexName);
      for (String key : index.keySet()) {
        for (String string : index.get(key)) {
          store.getOrCreate(indexName).put(key, string);
        }
      }
    }
  }
  return this;
}

代码示例来源:origin: org.reflections/reflections

/**
 * merges a Reflections instance metadata into this instance
 */
public Reflections merge(final Reflections reflections) {
  if (reflections.store != null) {
    for (String indexName : reflections.store.keySet()) {
      Multimap<String, String> index = reflections.store.get(indexName);
      for (String key : index.keySet()) {
        for (String string : index.get(key)) {
          store.getOrCreate(indexName).put(key, string);
        }
      }
    }
  }
  return this;
}

代码示例来源:origin: org.reflections/reflections

public Reflections read(InputStream inputStream) {
  Reflections reflections;
  try {
    Constructor<Reflections> constructor = Reflections.class.getDeclaredConstructor();
    constructor.setAccessible(true);
    reflections = constructor.newInstance();
  } catch (Exception e) {
    reflections = new Reflections(new ConfigurationBuilder());
  }
  try {
    Document document = new SAXReader().read(inputStream);
    for (Object e1 : document.getRootElement().elements()) {
      Element index = (Element) e1;
      for (Object e2 : index.elements()) {
        Element entry = (Element) e2;
        Element key = entry.element("key");
        Element values = entry.element("values");
        for (Object o3 : values.elements()) {
          Element value = (Element) o3;
          reflections.getStore().getOrCreate(index.getName()).put(key.getText(), value.getText());
        }
      }
    }
  } catch (DocumentException e) {
    throw new ReflectionsException("could not read.", e);
  } catch (Throwable e) {
    throw new RuntimeException("Could not read. Make sure relevant dependencies exist on classpath.", e);
  }
  return reflections;
}

代码示例来源:origin: ronmamo/reflections

public Reflections read(InputStream inputStream) {
  Reflections reflections;
  try {
    Constructor<Reflections> constructor = Reflections.class.getDeclaredConstructor();
    constructor.setAccessible(true);
    reflections = constructor.newInstance();
  } catch (Exception e) {
    reflections = new Reflections(new ConfigurationBuilder());
  }
  try {
    Document document = new SAXReader().read(inputStream);
    for (Object e1 : document.getRootElement().elements()) {
      Element index = (Element) e1;
      for (Object e2 : index.elements()) {
        Element entry = (Element) e2;
        Element key = entry.element("key");
        Element values = entry.element("values");
        for (Object o3 : values.elements()) {
          Element value = (Element) o3;
          reflections.getStore().getOrCreate(index.getName()).put(key.getText(), value.getText());
        }
      }
    }
  } catch (DocumentException e) {
    throw new ReflectionsException("could not read.", e);
  } catch (Throwable e) {
    throw new RuntimeException("Could not read. Make sure relevant dependencies exist on classpath.", e);
  }
  return reflections;
}

代码示例来源:origin: org.reflections/reflections

/**
 * constructs a Reflections instance and scan according to given {@link org.reflections.Configuration}
 * <p>it is preferred to use {@link org.reflections.util.ConfigurationBuilder}
 */
public Reflections(final Configuration configuration) {
  this.configuration = configuration;
  store = new Store(configuration);
  if (configuration.getScanners() != null && !configuration.getScanners().isEmpty()) {
    //inject to scanners
    for (Scanner scanner : configuration.getScanners()) {
      scanner.setConfiguration(configuration);
      scanner.setStore(store.getOrCreate(scanner.getClass().getSimpleName()));
    }
    scan();
    if (configuration.shouldExpandSuperTypes()) {
      expandSuperTypes();
    }
  }
}

代码示例来源:origin: ronmamo/reflections

/**
 * constructs a Reflections instance and scan according to given {@link org.reflections.Configuration}
 * <p>it is preferred to use {@link org.reflections.util.ConfigurationBuilder}
 */
public Reflections(final Configuration configuration) {
  this.configuration = configuration;
  store = new Store(configuration);
  if (configuration.getScanners() != null && !configuration.getScanners().isEmpty()) {
    //inject to scanners
    for (Scanner scanner : configuration.getScanners()) {
      scanner.setConfiguration(configuration);
      scanner.setStore(store.getOrCreate(index(scanner.getClass())));
    }
    scan();
    if (configuration.shouldExpandSuperTypes()) {
      expandSuperTypes();
    }
  }
}

代码示例来源:origin: ai.h2o/reflections

/**
 * merges a Reflections instance metadata into this instance
 */
public Reflections merge(final Reflections reflections) {
  if (reflections.store != null) {
    for (String indexName : reflections.store.keySet()) {
      Multimap<String, String> index = reflections.store.get(indexName);
      for (String key : index.keySet()) {
        for (String string : index.get(key)) {
          store.getOrCreate(indexName).put(key, string);
        }
      }
    }
  }
  return this;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

/**
 * merges a Reflections instance metadata into this instance
 */
public Reflections merge(final Reflections reflections) {
  if (reflections.store != null) {
    for (String indexName : reflections.store.keySet()) {
      Multimap<String, String> index = reflections.store.get(indexName);
      for (String key : index.keySet()) {
        for (String string : index.get(key)) {
          store.getOrCreate(indexName).put(key, string);
        }
      }
    }
  }
  return this;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

public Reflections read(InputStream inputStream) {
  Reflections reflections;
  try {
    Constructor<Reflections> constructor = Reflections.class.getDeclaredConstructor();
    constructor.setAccessible(true);
    reflections = constructor.newInstance();
  } catch (Exception e) {
    reflections = new Reflections(new ConfigurationBuilder());
  }
  try {
    Document document = new SAXReader().read(inputStream);
    for (Object e1 : document.getRootElement().elements()) {
      Element index = (Element) e1;
      for (Object e2 : index.elements()) {
        Element entry = (Element) e2;
        Element key = entry.element("key");
        Element values = entry.element("values");
        for (Object o3 : values.elements()) {
          Element value = (Element) o3;
          reflections.getStore().getOrCreate(index.getName()).put(key.getText(), value.getText());
        }
      }
    }
  } catch (DocumentException e) {
    throw new ReflectionsException("could not read.", e);
  } catch (Throwable e) {
    throw new RuntimeException("Could not read. Make sure relevant dependencies exist on classpath.", e);
  }
  return reflections;
}

代码示例来源:origin: ai.h2o/reflections

public Reflections read(InputStream inputStream) {
  Reflections reflections;
  try {
    Constructor<Reflections> constructor = Reflections.class.getDeclaredConstructor();
    constructor.setAccessible(true);
    reflections = constructor.newInstance();
  } catch (Exception e) {
    reflections = new Reflections(new ConfigurationBuilder());
  }
  try {
    Document document = new SAXReader().read(inputStream);
    for (Object e1 : document.getRootElement().elements()) {
      Element index = (Element) e1;
      for (Object e2 : index.elements()) {
        Element entry = (Element) e2;
        Element key = entry.element("key");
        Element values = entry.element("values");
        for (Object o3 : values.elements()) {
          Element value = (Element) o3;
          reflections.getStore().getOrCreate(index.getName()).put(key.getText(), value.getText());
        }
      }
    }
  } catch (DocumentException e) {
    throw new ReflectionsException("could not read.", e);
  } catch (Throwable e) {
    throw new RuntimeException("Could not read. Make sure relevant dependencies exist on classpath.", e);
  }
  return reflections;
}

代码示例来源:origin: org.rapidpm/rapidpm-dependencies-core-reflections

public Reflections read(InputStream inputStream) {
 Reflections reflections;
 try {
  Constructor<Reflections> constructor = Reflections.class.getDeclaredConstructor();
  constructor.setAccessible(true);
  reflections = constructor.newInstance();
 } catch (Exception e) {
  reflections = new Reflections(new ConfigurationBuilder());
 }
 try {
  Document document = new SAXReader().read(inputStream);
  for (Object e1 : document.getRootElement().elements()) {
   Element index = (Element) e1;
   for (Object e2 : index.elements()) {
    Element entry = (Element) e2;
    Element key = entry.element("key");
    Element values = entry.element("values");
    for (Object o3 : values.elements()) {
     Element value = (Element) o3;
     reflections.getStore().getOrCreate(index.getName()).put(key.getText() , value.getText());
    }
   }
  }
 } catch (DocumentException e) {
  throw new ReflectionsException("could not read." , e);
 } catch (Throwable e) {
  throw new RuntimeException("Could not read. Make sure relevant dependencies exist on classpath." , e);
 }
 return reflections;
}

代码示例来源:origin: ai.h2o/reflections

/**
 * constructs a Reflections instance and scan according to given {@link org.reflections.Configuration}
 * <p>it is preferred to use {@link org.reflections.util.ConfigurationBuilder}
 */
public Reflections(final Configuration configuration) {
  this.configuration = configuration;
  store = new Store(configuration);
  if (configuration.getScanners() != null && !configuration.getScanners().isEmpty()) {
    //inject to scanners
    for (Scanner scanner : configuration.getScanners()) {
      scanner.setConfiguration(configuration);
      scanner.setStore(store.getOrCreate(scanner.getClass().getSimpleName()));
    }
    scan();
  }
}

代码示例来源:origin: org.rapidpm/rapidpm-dependencies-core-reflections

public Reflections(final Configuration configuration) {
 this.configuration = configuration;
 store = new Store(configuration);
 if (configuration.getScanners() != null && ! configuration.getScanners().isEmpty()) {
  //inject to scanners
  for (Scanner scanner : configuration.getScanners()) {
   scanner.setConfiguration(configuration);
   scanner.setStore(store.getOrCreate(scanner.getClass().getSimpleName()));
  }
  scan();
  if (configuration.shouldExpandSuperTypes()) {
   expandSuperTypes();
  }
 }
}

代码示例来源:origin: org.rapidpm/rapidpm-dependencies-core-reflections

public Reflections merge(final Reflections reflections) {
 if (reflections.store != null) {
  for (String indexName : reflections.store.keySet()) {
   Multimap<String, String> index = reflections.store.get(indexName);
   for (String key : index.keySet()) {
    for (String string : index.get(key)) {
     store.getOrCreate(indexName).put(key , string);
    }
   }
  }
 }
 return this;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections

/**
 * constructs a Reflections instance and scan according to given {@link org.reflections.Configuration}
 * <p>it is preferred to use {@link org.reflections.util.ConfigurationBuilder}
 */
public Reflections(final Configuration configuration) {
  this.configuration = configuration;
  store = new Store(configuration);
  if (configuration.getScanners() != null && !configuration.getScanners().isEmpty()) {
    //inject to scanners
    for (Scanner scanner : configuration.getScanners()) {
      scanner.setConfiguration(configuration);
      scanner.setStore(store.getOrCreate(scanner.getClass().getSimpleName()));
    }
    scan();
    if (configuration.shouldExpandSuperTypes()) {
      expandSuperTypes();
    }
  }
}

相关文章