loci.formats
Class MetadataTools

java.lang.Object
  extended by loci.formats.MetadataTools

public final class MetadataTools
extends Object

A utility class for working with metadata objects, including MetadataStore, MetadataRetrieve, and OME-XML strings. Most of the methods require the optional loci.formats.ome package, and optional ome-java.jar library, to be present at runtime.

Source code:
Trac, SVN


Method Summary
static void convertMetadata(MetadataRetrieve src, MetadataStore dest)
          Copies information from a metadata retrieval object (source) into a metadata store (destination).
static void convertMetadata(String xml, MetadataStore dest)
          Converts information from an OME-XML string (source) into a metadata store (destination).
static MetadataStore createOMEXMLMetadata()
          Creates an OME-XML metadata object using reflection, to avoid direct dependencies on the optional loci.formats.ome package.
static MetadataStore createOMEXMLMetadata(String xml)
          Creates an OME-XML metadata object using reflection, to avoid direct dependencies on the optional loci.formats.ome package, wrapping a DOM representation of the given OME-XML string.
static String getOMEXML(MetadataRetrieve src)
          Extracts an OME-XML metadata string from the given metadata object, by converting to an OME-XML metadata object if necessary.
static boolean isOMEXMLMetadata(Object o)
          Checks whether the given object is an OME-XML metadata object.
static void populateOriginalMetadata(Object o, String key, String value)
          Adds the specified key/value pair as a new OriginalMetadata node to the given OME-XML metadata object.
static void validateOMEXML(String xml)
          Attempts to validate the given OME-XML string using Java's XML validation facility.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createOMEXMLMetadata

public static MetadataStore createOMEXMLMetadata()
Creates an OME-XML metadata object using reflection, to avoid direct dependencies on the optional loci.formats.ome package.

Returns:
A new instance of loci.formats.ome.OMEXMLMetadata, or null if the class is not available.

createOMEXMLMetadata

public static MetadataStore createOMEXMLMetadata(String xml)
Creates an OME-XML metadata object using reflection, to avoid direct dependencies on the optional loci.formats.ome package, wrapping a DOM representation of the given OME-XML string.

Returns:
A new instance of loci.formats.ome.OMEXMLMetadata, or null if the class is not available.

isOMEXMLMetadata

public static boolean isOMEXMLMetadata(Object o)
Checks whether the given object is an OME-XML metadata object.

Returns:
True iff the object is an instance of loci.formats.ome.OMEXMLMetadata.

populateOriginalMetadata

public static void populateOriginalMetadata(Object o,
                                            String key,
                                            String value)
Adds the specified key/value pair as a new OriginalMetadata node to the given OME-XML metadata object. Does nothing unless the given object is an OME-XML metadata object.

Parameters:
o - An object of type loci.formats.ome.OMEXMLMetadata.
key - Metadata key to populate.
value - Metadata value corresponding to the specified key.

getOMEXML

public static String getOMEXML(MetadataRetrieve src)
Extracts an OME-XML metadata string from the given metadata object, by converting to an OME-XML metadata object if necessary.


validateOMEXML

public static void validateOMEXML(String xml)
Attempts to validate the given OME-XML string using Java's XML validation facility. Requires Java 1.5+.


convertMetadata

public static void convertMetadata(String xml,
                                   MetadataStore dest)
Converts information from an OME-XML string (source) into a metadata store (destination).


convertMetadata

public static void convertMetadata(MetadataRetrieve src,
                                   MetadataStore dest)
Copies information from a metadata retrieval object (source) into a metadata store (destination).