Package org.esa.snap.core.metadata
Class XmlMetadataParserFactory
java.lang.Object
org.esa.snap.core.metadata.XmlMetadataParserFactory
This factory class returns instances of
XmlMetadataParsers that have been previously
registered with it.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends GenericXmlMetadata>
XmlMetadataParser<T> Returns a parser instance for the given metadata class.static <T extends GenericXmlMetadata>
voidregisterParser(Class clazz, XmlMetadataParser<T> parser) Registers a parser instance, attached to the given metadata class, to this factory.
-
Constructor Details
-
XmlMetadataParserFactory
public XmlMetadataParserFactory()
-
-
Method Details
-
registerParser
public static <T extends GenericXmlMetadata> void registerParser(Class clazz, XmlMetadataParser<T> parser) Registers a parser instance, attached to the given metadata class, to this factory. The metadata class should be an extension ofGenericXmlMetadata- Type Parameters:
T- Generic type for metadata class.- Parameters:
clazz- The metadata class.parser- The parser instance.
-
getParser
public static <T extends GenericXmlMetadata> XmlMetadataParser<T> getParser(Class clazz) throws InstantiationException Returns a parser instance for the given metadata class. If no parser was previously registered for the class, it will throw an exception.- Type Parameters:
T- Generic type for the metadata class.- Parameters:
clazz- The metadata class.- Returns:
- The parser instance.
- Throws:
InstantiationException- Exception is thrown if no parser was registered for the input class.
-