Skip to content

Commit b21bcfb

Browse files
committed
Add method returning a mapping from tag name to tag value for more generic access.
1 parent 5754a0d commit b21bcfb

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Source/com/drew/metadata/Directory.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,26 @@ public String getDescription(int tagType)
11471147
return _descriptor.getDescription(tagType);
11481148
}
11491149

1150+
/**
1151+
* Provides a mapping from tag name to it's value.
1152+
* Only nonnull values are returned.
1153+
*
1154+
* @return Map<String, Object>
1155+
*/
1156+
public Map<String, Object> getTagMap()
1157+
{
1158+
final Map<String, Object> tagMap = new HashMap<String, Object>();
1159+
for (Map.Entry<Integer, String> entry : getTagNameMap().entrySet())
1160+
{
1161+
final Object value = _tagMap.get(entry.getKey());
1162+
if (value != null)
1163+
{
1164+
tagMap.put(entry.getValue(), value);
1165+
}
1166+
}
1167+
return Collections.unmodifiableMap(tagMap);
1168+
}
1169+
11501170
@Override
11511171
public String toString()
11521172
{

0 commit comments

Comments
 (0)