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

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

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

Model.getFieldDescriptorsForClass介绍

[英]Takes a Class, and generates a Map of all FieldDescriptors that are the class fields or any of its parents. The Class may be a dynamic class - ie not in the model, although at least one of its parents are in the model.
[中]获取一个类,并生成作为类字段或其任何父字段的所有字段描述符的映射。该类可能是一个动态类,即不在模型中,但至少有一个父类在模型中。

代码示例

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

private void storeNonInterMineObject(FastPathObject nimo, Source source, Source skelSource,
    int type) throws IllegalAccessException, ObjectStoreException {
  long time1 = System.currentTimeMillis();
  FastPathObject newObj = DynamicUtil.createObject(nimo.getClass());
  long time2 = System.currentTimeMillis();
  timeSpentCreate += time2 - time1;
  Map<String, FieldDescriptor> fields = getModel().getFieldDescriptorsForClass(nimo
      .getClass());
  for (Map.Entry<String, FieldDescriptor> entry : fields.entrySet()) {
    FieldDescriptor field = entry.getValue();
    copyField(nimo, newObj, source, skelSource, field, type);
  }
  time1 = System.currentTimeMillis();
  timeSpentCopyFields += time1 - time2;
  store(newObj);
  time2 = System.currentTimeMillis();
  timeSpentStore += time2 - time1;
}

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

private void storeNonInterMineObject(FastPathObject nimo, Source source, Source skelSource,
    int type) throws IllegalAccessException, ObjectStoreException {
  long time1 = System.currentTimeMillis();
  FastPathObject newObj = DynamicUtil.createObject(nimo.getClass());
  long time2 = System.currentTimeMillis();
  timeSpentCreate += time2 - time1;
  Map<String, FieldDescriptor> fields = getModel().getFieldDescriptorsForClass(nimo
      .getClass());
  for (Map.Entry<String, FieldDescriptor> entry : fields.entrySet()) {
    FieldDescriptor field = entry.getValue();
    copyField(nimo, newObj, source, skelSource, field, type);
  }
  time1 = System.currentTimeMillis();
  timeSpentCopyFields += time1 - time2;
  store(newObj);
  time2 = System.currentTimeMillis();
  timeSpentStore += time2 - time1;
}

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

/**
 * Takes a Class, and generates a Map of all the collections that are in the Class or any of its
 * parents. The Class may be a dynamic class - ie not in the model, although at least one of its
 * parents are in the model.
 *
 * @param c a Class
 * @return a Map from String collection name to Class element type
 */
public Map<String, Class<?>> getCollectionsForClass(Class<?> c) {
  synchronized (classToCollectionsMap) {
    Map<String, Class<?>> retval = classToCollectionsMap.get(c);
    if (retval == null) {
      retval = new LinkedHashMap<String, Class<?>>();
      for (FieldDescriptor fd : getFieldDescriptorsForClass(c).values()) {
        if (fd instanceof CollectionDescriptor) {
          CollectionDescriptor cd = (CollectionDescriptor) fd;
          retval.put(cd.getName(), cd.getReferencedClassDescriptor().getType());
        }
      }
      classToCollectionsMap.put(c, retval);
    }
    return retval;
  }
}

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

/**
 * Takes a Class, and generates a Map of all the collections that are in the Class or any of its
 * parents. The Class may be a dynamic class - ie not in the model, although at least one of its
 * parents are in the model.
 *
 * @param c a Class
 * @return a Map from String collection name to Class element type
 */
public Map<String, Class<?>> getCollectionsForClass(Class<?> c) {
  synchronized (classToCollectionsMap) {
    Map<String, Class<?>> retval = classToCollectionsMap.get(c);
    if (retval == null) {
      retval = new LinkedHashMap<String, Class<?>>();
      for (FieldDescriptor fd : getFieldDescriptorsForClass(c).values()) {
        if (fd instanceof CollectionDescriptor) {
          CollectionDescriptor cd = (CollectionDescriptor) fd;
          retval.put(cd.getName(), cd.getReferencedClassDescriptor().getType());
        }
      }
      classToCollectionsMap.put(c, retval);
    }
    return retval;
  }
}

代码示例来源: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

Map<String, FieldDescriptor> fields = os.getModel().getFieldDescriptorsForClass(retval
    .getClass());
for (Map.Entry<String, FieldDescriptor> entry : fields.entrySet()) {

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

Map<String, FieldDescriptor> fields = os.getModel().getFieldDescriptorsForClass(retval
    .getClass());
for (Map.Entry<String, FieldDescriptor> entry : fields.entrySet()) {

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

Map<String, FieldDescriptor> fields = getModel().getFieldDescriptorsForClass(newObj
    .getClass());
Map<String, Source> trackingMap = new HashMap<String, Source>();

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

Map<String, FieldDescriptor> fields = getModel().getFieldDescriptorsForClass(newObj
    .getClass());
Map<String, Source> trackingMap = new HashMap<String, Source>();

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

FieldDescriptor field = model.getFieldDescriptorsForClass(clazz).get(fieldName);
if (field == null) {
  throw new ObjectStoreException("Field " + clazz.getName() + "." + fieldName

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

FieldDescriptor field = model.getFieldDescriptorsForClass(clazz).get(fieldName);
if (field == null) {
  throw new ObjectStoreException("Field " + clazz.getName() + "." + fieldName

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

if (ref instanceof QueryCollectionReference) {
  ReferenceDescriptor refDesc = (ReferenceDescriptor) schema.getModel()
    .getFieldDescriptorsForClass(ref.getQcType()).get(ref.getFieldName());
  if (refDesc.relationType() == FieldDescriptor.M_N_RELATION) {
    tablenames.add(DatabaseUtil.getIndirectionTableName((CollectionDescriptor)

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

if (ref instanceof QueryCollectionReference) {
  ReferenceDescriptor refDesc = (ReferenceDescriptor) schema.getModel()
    .getFieldDescriptorsForClass(ref.getQcType()).get(ref.getFieldName());
  if (refDesc.relationType() == FieldDescriptor.M_N_RELATION) {
    tablenames.add(DatabaseUtil.getIndirectionTableName((CollectionDescriptor)

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

.getFieldDescriptorsForClass(qc.getType());
Map<String, String> fieldToAlias = state.getFieldToAlias(qc);
Iterator<FieldDescriptor> fieldIter = null;

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

.getFieldDescriptorsForClass(qc.getType());
Map<String, String> fieldToAlias = state.getFieldToAlias(qc);
Iterator<FieldDescriptor> fieldIter = null;

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

Query q = new Query();
Class<? extends InterMineObject> cls = obj.getClass();
Map<String, FieldDescriptor> fields = model.getFieldDescriptorsForClass(cls);
QueryClass qc = new QueryClass(cls);
q.addFrom(qc);

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

Query q = new Query();
Class<? extends InterMineObject> cls = obj.getClass();
Map<String, FieldDescriptor> fields = model.getFieldDescriptorsForClass(cls);
QueryClass qc = new QueryClass(cls);
q.addFrom(qc);

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

} else {
  AttributeDescriptor desc = (AttributeDescriptor) schema
    .getModel().getFieldDescriptorsForClass(((QueryClass) qc)
    .getType()).get(((QueryField) newFirstOrderBy)
            .getFieldName());

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

} else {
  AttributeDescriptor desc = (AttributeDescriptor) schema
    .getModel().getFieldDescriptorsForClass(((QueryClass) qc)
    .getType()).get(((QueryField) newFirstOrderBy)
            .getFieldName());

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

.getFieldDescriptorsForClass(connectingClass);
FieldDescriptor fd = descriptorMap.get(connectingClassFieldName);

相关文章