Class XmlMetadataParserFactory


  • public class XmlMetadataParserFactory
    extends Object
    This factory class returns instances of XmlMetadataParsers that have been previously registered with it.
    • Constructor Detail

      • XmlMetadataParserFactory

        public XmlMetadataParserFactory()
    • Method Detail

      • 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 of GenericXmlMetadata
        Type Parameters:
        T - Generic type for metadata class.
        Parameters:
        clazz - The metadata class.
        parser - The parser instance.
      • getParser

        public static <T extends GenericXmlMetadataXmlMetadataParser<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.