com.drew.metadata
Class Metadata

java.lang.Object
  extended by com.drew.metadata.Metadata

public final class Metadata
extends Object

A top-level object to hold the various types of metadata (Exif/IPTC/etc) related to one entity (such as a file or stream).

Metadata objects may contain zero or more directories. Each directory may contain zero or more tags with corresponding values.

Author:
Drew Noakes http://drewnoakes.com

Constructor Summary
Metadata()
           
 
Method Summary
 boolean containsDirectory(Class<? extends Directory> type)
          Indicates whether a given directory type has been created in this metadata repository.
 Iterable<Directory> getDirectories()
          Returns an objects for iterating over Directory objects in the order in which they were added.
<T extends Directory>
T
getDirectory(Class<T> type)
          If this Metadata object contains a Directory of the specified type, it is returned.
 int getDirectoryCount()
          Returns a count of unique directories in this metadata collection.
<T extends Directory>
T
getOrCreateDirectory(Class<T> type)
          Returns a Directory of specified type.
 boolean hasErrors()
          Indicates whether any errors were reported during the reading of metadata values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Metadata

public Metadata()
Method Detail

getDirectories

public Iterable<Directory> getDirectories()
Returns an objects for iterating over Directory objects in the order in which they were added.

Returns:
an iterable collection of directories

getDirectoryCount

public int getDirectoryCount()
Returns a count of unique directories in this metadata collection.

Returns:
the number of unique directory types set for this metadata collection

getOrCreateDirectory

public <T extends Directory> T getOrCreateDirectory(Class<T> type)
Returns a Directory of specified type. If this Metadata object already contains such a directory, it is returned. Otherwise a new instance of this directory will be created and stored within this Metadata object.

Parameters:
type - the type of the Directory implementation required.
Returns:
a directory of the specified type.

getDirectory

public <T extends Directory> T getDirectory(Class<T> type)
If this Metadata object contains a Directory of the specified type, it is returned. Otherwise null is returned.

Type Parameters:
T - the Directory type
Parameters:
type - the Directory type
Returns:
a Directory of type T if it exists in this Metadata object, otherwise null.

containsDirectory

public boolean containsDirectory(Class<? extends Directory> type)
Indicates whether a given directory type has been created in this metadata repository. Directories are created by calling getOrCreateDirectory(Class).

Parameters:
type - the Directory type
Returns:
true if the metadata directory has been created

hasErrors

public boolean hasErrors()
Indicates whether any errors were reported during the reading of metadata values. This value will be true if Directory.hasErrors() is true for one of the contained Directory objects.

Returns:
whether one of the contained directories has an error


Copyright © 2012. All Rights Reserved.