public class MetadataCollection
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
MetadataCollection()
Constructs an empty MetadataCollection.
|
MetadataCollection(Metadata[] metadata)
Constructs a MetadataCollection from an array of Metadata objects.
|
Modifier and Type | Method and Description |
---|---|
MetadataCollection |
clone() |
boolean |
contains(java.lang.String name)
Returns true if this collection contains a Metadata object with the given
name.
|
Metadata |
getMetadata(java.lang.String name)
Returns the Metadata object with the given name or null if it does not
exist.
|
java.util.Set<java.lang.String> |
getNames()
Returns a Set containing all the keys (names) contained in this
collection.
|
java.util.Iterator<Metadata> |
iterator()
Returns an iterator over the Metadata objects in this collection
|
void |
merge(MetadataCollection m)
Calls the 'update' method for each Metadata object in the given
MetadataCollection.
|
Metadata |
removeMetadata(java.lang.String name)
Removes the Metadata object with the given name from the collection.
|
Metadata |
setMetadata(Metadata m)
Adds the specified Metadata object to this collection, using its name as
the hashmap key.
|
java.lang.String |
toString() |
java.lang.String |
toXML(java.lang.String indent)
returns a String representing this metadata collection in XML format.
|
void |
update(Metadata m)
If the collection does not already contain a Metadata object with the
same name as argument, then the argument is added to the collection.
|
public MetadataCollection()
public MetadataCollection(Metadata[] metadata)
metadata
- the Metadata array.public MetadataCollection clone()
clone
in class java.lang.Object
public boolean contains(java.lang.String name)
name
- the name to search for.public Metadata getMetadata(java.lang.String name)
name
- the Metadata name to search forpublic Metadata removeMetadata(java.lang.String name)
name
- the name of the Metadata object to remove.public Metadata setMetadata(Metadata m)
m
- the Metadata to setpublic void update(Metadata m)
m
- the Metadata object to update.public void merge(MetadataCollection m)
m
- the MetadataCollection to merge with.public java.util.Iterator<Metadata> iterator()
public java.util.Set<java.lang.String> getNames()
public java.lang.String toXML(java.lang.String indent)
public java.lang.String toString()
toString
in class java.lang.Object