Class RootElementNameContentWorkerSelector<W extends ContentWorker>

    • Constructor Detail

      • RootElementNameContentWorkerSelector

        public RootElementNameContentWorkerSelector()
    • Method Detail

      • setSupportedMimetypes

        public void setSupportedMimetypes​(Set<String> supportedMimetypes)
        Optionally set the mimetypes supported. They must be XML formats that the chosen parser will be able to handle.
        Parameters:
        supportedMimetypes - the list of mimetypes. The default is text/xml.
      • setWorkers

        public void setWorkers​(Map<String,​W> workers)
        Set the workers to choose from.
        Parameters:
        workers - a map of ContentWorker instances keyed by root element name
      • init

        public void init()
        Checks the configuration.
      • getWorker

        public W getWorker​(ContentReader reader)
        Performs a match of the root element name to find the correct content worker.
        Specified by:
        getWorker in interface ContentWorkerSelector<W extends ContentWorker>
        Parameters:
        reader - the content reader, providing the actual stream metadata and even the stream, if required.
        Returns:
        Return a worker that can operate on the content, or null if this identifier doesn't support the content.