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

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

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

Model.getQualifiedTypeName介绍

[英]Return the qualified name of the given unqualified class name. The className must be in the given model or in the java.lang package or one of java.util.Date, java.math.BigDecimal, or org.intermine.objectstore.query.ClobAccess.
[中]返回给定非限定类名的限定名。类名必须在给定的模型或java中。lang包或java的一个。util。日期,爪哇。数学BigDecimal或org。间歇。objectstore。查询ClobAccess。

代码示例

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

/**
 * @param className class name
 * @return true if class is defined else false
 */
public boolean isGeneratedClassAvailable(String className) {
  try {
    getQualifiedTypeName(className);
    return true;
  } catch (ClassNotFoundException ex) {
    return false;
  }
}

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

/**
 * @param className class name
 * @return true if class is defined else false
 */
public boolean isGeneratedClassAvailable(String className) {
  try {
    getQualifiedTypeName(className);
    return true;
  } catch (ClassNotFoundException ex) {
    return false;
  }
}

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

public void testGetQualifiedTypeName() throws Exception {
  Model model = Model.getInstanceByName("basicmodel");
  assertEquals("org.intermine.model.basicmodel.Employee",
         model.getQualifiedTypeName("Employee"));
  assertEquals("java.lang.String",
         model.getQualifiedTypeName("String"));
  assertEquals("int",
         model.getQualifiedTypeName("int"));
  assertEquals("java.util.Date",
         model.getQualifiedTypeName("Date"));
  assertEquals("java.math.BigDecimal",
         model.getQualifiedTypeName("BigDecimal"));
  try {
    model.getQualifiedTypeName("SomeUnkownClass");
    fail("Expected ClassNotFoundException");
  } catch (ClassNotFoundException e) {
    // expected
  }
  try {
    model.getQualifiedTypeName("java.lang.String");
    fail("Expected IllegalArgumentException");
  } catch (IllegalArgumentException e) {
    // expected
  }
}

相关文章