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

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

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

Util.getPropertiesStartingWith介绍

[英]Returns all Properties in props that begin with str
[中]返回以str开头的道具中的所有属性

代码示例

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

  1. /**
  2. * Retrieve a map from key name to PrimaryKey object. The Map contains all the primary keys
  3. * that exist on a particular class, without performing any recursion.
  4. *
  5. * @param cld the ClassDescriptor to fetch primary keys for
  6. * @return the Map from key names to PrimaryKeys
  7. */
  8. public static Map<String, PrimaryKey> getPrimaryKeys(ClassDescriptor cld) {
  9. Map<String, PrimaryKey> keyMap = primaryKeyCache.get(cld);
  10. if (keyMap == null) {
  11. keyMap = new LinkedHashMap<String, PrimaryKey>();
  12. Properties keys = getKeyProperties(cld.getModel().getName());
  13. String cldName = Util.unqualifiedName(cld.getName());
  14. Properties cldKeys = Util.getPropertiesStartingWith(cldName, keys);
  15. cldKeys = Util.stripStart(cldName, cldKeys);
  16. List<String> keyNames = new ArrayList<String>();
  17. for (Object key : cldKeys.keySet()) {
  18. if (key instanceof String) {
  19. keyNames.add((String) key);
  20. }
  21. }
  22. Collections.sort(keyNames);
  23. for (String keyName : keyNames) {
  24. PrimaryKey key = new PrimaryKey(keyName, (String) cldKeys.get(keyName), cld);
  25. keyMap.put(keyName, key);
  26. }
  27. primaryKeyCache.put(cld, keyMap);
  28. }
  29. return keyMap;
  30. }

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

  1. /**
  2. * Retrieve a map from key name to PrimaryKey object. The Map contains all the primary keys
  3. * that exist on a particular class, without performing any recursion.
  4. *
  5. * @param cld the ClassDescriptor to fetch primary keys for
  6. * @return the Map from key names to PrimaryKeys
  7. */
  8. public static Map<String, PrimaryKey> getPrimaryKeys(ClassDescriptor cld) {
  9. Map<String, PrimaryKey> keyMap = primaryKeyCache.get(cld);
  10. if (keyMap == null) {
  11. keyMap = new LinkedHashMap<String, PrimaryKey>();
  12. Properties keys = getKeyProperties(cld.getModel().getName());
  13. String cldName = Util.unqualifiedName(cld.getName());
  14. Properties cldKeys = Util.getPropertiesStartingWith(cldName, keys);
  15. cldKeys = Util.stripStart(cldName, cldKeys);
  16. List<String> keyNames = new ArrayList<String>();
  17. for (Object key : cldKeys.keySet()) {
  18. if (key instanceof String) {
  19. keyNames.add((String) key);
  20. }
  21. }
  22. Collections.sort(keyNames);
  23. for (String keyName : keyNames) {
  24. PrimaryKey key = new PrimaryKey(keyName, (String) cldKeys.get(keyName), cld);
  25. keyMap.put(keyName, key);
  26. }
  27. primaryKeyCache.put(cld, keyMap);
  28. }
  29. return keyMap;
  30. }

相关文章