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); } } }
@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; }