コード例 #1
0
ファイル: AttributeService.java プロジェクト: noctarius/jimfs
  private static void readAll(File file, AttributeProvider provider, Map<String, Object> map) {
    for (String attribute : provider.attributes(file)) {
      Object value = provider.get(file, attribute);

      // check for null to protect against race condition when an attribute present when
      // attributes(file) was called is deleted before get() is called for that attribute
      if (value != null) {
        map.put(attribute, value);
      }
    }
  }
コード例 #2
0
ファイル: AttributeService.java プロジェクト: noctarius/jimfs
  @Nullable
  private Object getAttributeInternal(File file, String view, String attribute) {
    AttributeProvider provider = providersByName.get(view);
    if (provider == null) {
      return null;
    }

    Object value = provider.get(file, attribute);
    if (value == null) {
      for (String inheritedView : provider.inherits()) {
        value = getAttributeInternal(file, inheritedView, attribute);
        if (value != null) {
          break;
        }
      }
    }

    return value;
  }