org.intermine.metadata.Util.getFilename()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(147)

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

Util.getFilename介绍

[英]Given a key and model name, return filename for reading/writing.
[中]给定密钥和型号名称,返回文件名以进行读/写操作。

代码示例

代码示例来源:origin: intermine/intermine

/**
 * Load the key definitions file for the named model from the classpath
 * @param modelName the model name
 * @return the key definitions
 */
public static Properties loadKeyDefinitions(String modelName) {
  return loadProperties(getFilename(KEY_DEFINITIONS, modelName));
}

代码示例来源:origin: org.intermine/intermine-model

/**
 * Load the key definitions file for the named model from the classpath
 * @param modelName the model name
 * @return the key definitions
 */
public static Properties loadKeyDefinitions(String modelName) {
  return loadProperties(getFilename(KEY_DEFINITIONS, modelName));
}

代码示例来源:origin: intermine/intermine

/**
   * Load a named model from the classpath
   * @param name the model name
   * @return the model
   */
  public static Model loadModel(String name) {
    String filename = Util.getFilename(MODEL, name);

    InputStream is = Model.class.getClassLoader().getResourceAsStream(filename);

    if (is == null) {
      throw new IllegalArgumentException("Model definition file '" + filename
                        + "' cannot be found");
    }

    Model model = null;
    try {
      model = new InterMineModelParser().process(new InputStreamReader(is));
    } catch (Exception e) {
      throw new RuntimeException("Error parsing model definition file '" + filename + "'", e);
    }

    return model;
  }
}

代码示例来源:origin: org.intermine/intermine-model

/**
   * Load a named model from the classpath
   * @param name the model name
   * @return the model
   */
  public static Model loadModel(String name) {
    String filename = Util.getFilename(MODEL, name);

    InputStream is = Model.class.getClassLoader().getResourceAsStream(filename);

    if (is == null) {
      throw new IllegalArgumentException("Model definition file '" + filename
                        + "' cannot be found");
    }

    Model model = null;
    try {
      model = new InterMineModelParser().process(new InputStreamReader(is));
    } catch (Exception e) {
      throw new RuntimeException("Error parsing model definition file '" + filename + "'", e);
    }

    return model;
  }
}

相关文章