本文整理了Java中org.intermine.metadata.Model.getClassDescriptorByName()
方法的一些代码示例,展示了Model.getClassDescriptorByName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.getClassDescriptorByName()
方法的具体详情如下:
包路径:org.intermine.metadata.Model
类名称:Model
方法名:getClassDescriptorByName
[英]Get a ClassDescriptor by name, null if no ClassDescriptor of given name in Model.
[中]按名称获取ClassDescriptor,如果模型中没有给定名称的ClassDescriptor,则为null。
代码示例来源:origin: intermine/intermine
private void init() {
for (InterMineBag bag: bags) {
ClassDescriptor cd = model.getClassDescriptorByName(bag.getType());
classes.add(cd);
}
}
代码示例来源:origin: org.intermine/intermine-api
private void init() {
for (InterMineBag bag: bags) {
ClassDescriptor cd = model.getClassDescriptorByName(bag.getType());
classes.add(cd);
}
}
代码示例来源:origin: org.intermine/intermine-jbrowse-endpoint
@Override
protected void initState() {
super.initState();
prefix = getPropertyPrefix();
featureClass = webProperties.getProperty(prefix + "featureClass");
refPath = webProperties.getProperty(prefix + "paths.ref");
startPath = webProperties.getProperty(prefix + "paths.start");
endPath = webProperties.getProperty(prefix + "paths.end");
identPath = webProperties.getProperty(prefix + "paths.ident");
namePaths = webProperties.getProperty(prefix + "paths.names").split("\\|");
fcd = im.getModel().getClassDescriptorByName(featureClass);
}
代码示例来源:origin: org.intermine/intermine-objectstore
private static String getClassName(Class<?> cls, Model model) {
if (cls != null) {
ClassDescriptor cld = model.getClassDescriptorByName(cls.getName());
if (cld != null && !cld.isInterface()) {
return cld.getName();
}
}
return "";
}
代码示例来源:origin: intermine/intermine
private static String getClassName(Class<?> cls, Model model) {
if (cls != null) {
ClassDescriptor cld = model.getClassDescriptorByName(cls.getName());
if (cld != null && !cld.isInterface()) {
return cld.getName();
}
}
return "";
}
代码示例来源:origin: org.intermine/intermine-api
/**
* @param type the type to set
* @throws ObjectStoreException if something goes wrong
*/
public void setType(String type)
throws ObjectStoreException {
if (os.getModel().getClassDescriptorByName(type) != null) {
this.type = type;
storeSavedBag();
}
}
代码示例来源:origin: intermine/intermine
public void testFieldsInNonInterMineObject() throws Exception {
Model model = Model.getInstanceByName("basicmodel");
ClassDescriptor cld = model.getClassDescriptorByName("SimpleObject");
assertEquals(3, cld.getAllFieldDescriptors().size());
assertEquals(
new HashSet<String>(Arrays.asList("employee", "name")),
model.getFieldDescriptorsForClass(SimpleObject.class).keySet());
}
代码示例来源:origin: intermine/intermine
public void testGetPrimaryKeysCld() {
ClassDescriptor cld = model.getClassDescriptorByName("org.intermine.model.basicmodel.Employee");
expected.put("key1", new PrimaryKey("key1", "name, age", cld));
expected.put("key2", new PrimaryKey("key2", "name, fullTime", cld));
assertEquals(expected, PrimaryKeyUtil.getPrimaryKeys(cld));
}
代码示例来源:origin: intermine/intermine
public void testGetClassDescriptorByName() throws MetaDataException {
ClassDescriptor cld1 = cdMaker.makeClass("Class1");
ClassDescriptor cld2 = cdMaker.makeClass("Class2");
Model model = new Model("model", cdMaker.getPackageName(), Arrays.asList(cld1, cld2));
assertEquals(cld1, model.getClassDescriptorByName("Class1"));
assertEquals(cld2, model.getClassDescriptorByName("Class2"));
}
代码示例来源:origin: intermine/intermine
public void testGetPrimaryKeysCldSource2() throws Exception {
ClassDescriptor cld = model.getClassDescriptorByName("org.intermine.model.testmodel.Company");
Source source = new Source("testsource4");
Set expected = new HashSet();
expected.add(new PrimaryKey("key1", "name,address", cld));
expected.add(new PrimaryKey("key2", "vatNumber", cld));
assertEquals(expected, DataLoaderHelper.getPrimaryKeys(cld, source, null));
}
代码示例来源:origin: intermine/intermine
public void testObjectPrimaryKeyIsNullNullField() throws Exception {
Source source = new Source("testsource");
Employable e =
(Employable) DynamicUtil.createObject(Collections.singleton(Employable.class));
e.setName(null);
ClassDescriptor cld =
model.getClassDescriptorByName("org.intermine.model.testmodel.Employable");
Set primaryKeys = new HashSet(PrimaryKeyUtil.getPrimaryKeys(cld).values());
PrimaryKey pk = (PrimaryKey) primaryKeys.iterator().next();
assertFalse(DataLoaderHelper.objectPrimaryKeyNotNull(model, e, cld, pk, source, new IntToIntMap()));
}
代码示例来源:origin: intermine/intermine
public void testCloneCollectionDescriptors() throws Exception {
ClassDescriptor cld = testModel
.getClassDescriptorByName("org.intermine.model.testmodel.Company");
Set colls = cld.getCollectionDescriptors();
Set copy = ModelMerger.cloneCollectionDescriptors(colls);
assertEquals(colls, copy);
}
代码示例来源:origin: intermine/intermine
public void testCloneAttributeDescriptors() throws Exception {
ClassDescriptor cld = testModel
.getClassDescriptorByName("org.intermine.model.testmodel.Employee");
Set attrs = cld.getAttributeDescriptors();
Set copy = ModelMerger.cloneAttributeDescriptors(attrs);
assertEquals(attrs, copy);
}
代码示例来源:origin: intermine/intermine
public void testCloneReferenceDescriptors() throws Exception {
ClassDescriptor cld = testModel
.getClassDescriptorByName("org.intermine.model.testmodel.Company");
Set refs = cld.getReferenceDescriptors();
Set copy = ModelMerger.cloneReferenceDescriptors(refs);
assertEquals(refs, copy);
}
代码示例来源:origin: intermine/intermine
public void testGetClassDescriptorByWrongName() throws Exception {
ClassDescriptor cld1 = cdMaker.makeClass("Class1");
ClassDescriptor cld2 = cdMaker.makeClass("Class2");
Model model = new Model("model", cdMaker.getPackageName(), Arrays.asList(cld1, cld2));
assertTrue(null == model.getClassDescriptorByName("WrongName"));
}
代码示例来源:origin: intermine/intermine
public void testGetPrimaryKeysCldSource3() throws Exception {
ClassDescriptor cld = model.getClassDescriptorByName("org.intermine.model.testmodel.Company");
Source source = new Source("testsource2");
assertEquals(new HashSet(Arrays.asList(new PrimaryKey("key1", "name, address", cld), new PrimaryKey("local_key", "name, vatNumber", cld))), DataLoaderHelper.getPrimaryKeys(cld, source, null));
}
代码示例来源:origin: intermine/intermine
public void testObjectPrimaryKeyIsNullNullField3() throws Exception {
Department d = (Department) DynamicUtil.createObject(Collections.singleton(Department.class));
d.setName("jkhsdfg");
Company c = (Company) DynamicUtil.createObject(Collections.singleton(Company.class));
c.setAddress(null);
c.setVatNumber(765213);
d.setCompany(c);
ClassDescriptor cld =
model.getClassDescriptorByName("org.intermine.model.testmodel.Department");
PrimaryKey pk = (PrimaryKey) PrimaryKeyUtil.getPrimaryKeys(cld).get("key1");
assertTrue(DataLoaderHelper.objectPrimaryKeyNotNull(model, d, cld, pk, null, new IntToIntMap()));
}
代码示例来源:origin: intermine/intermine
public void testValid3() throws Exception {
String stringPath = "Employee.age";
Path path = new Path(model, stringPath);
assertEquals(model.getClassDescriptorByName("org.intermine.pathquery.model.testmodel.Employee"), path.getStartClassDescriptor());
assertEquals(Integer.class, path.getEndType());
}
代码示例来源:origin: intermine/intermine
public void testGetPrimaryKeysCldSource() throws Exception {
ClassDescriptor cld = model.getClassDescriptorByName("org.intermine.model.testmodel.Company");
Source source = new Source("testsource");
assertEquals(Collections.singleton(new PrimaryKey("key1", "name, address", cld)), DataLoaderHelper.getPrimaryKeys(cld, source, null));
source = new Source("testsource5");
try {
DataLoaderHelper.getPrimaryKeys(cld, source, null);
fail("Was expecting an exception");
} catch (IllegalArgumentException e) {
}
}
代码示例来源:origin: intermine/intermine
public void testValid2() throws Exception {
String stringPath = "Department.company.name";
Path path = new Path(model, stringPath);
ClassDescriptor cld =
model.getClassDescriptorByName("org.intermine.pathquery.model.testmodel.Department");
assertEquals(String.class, path.getEndType());
assertEquals(cld, path.getStartClassDescriptor());
}
内容来源于网络,如有侵权,请联系作者删除!