Class XmlInputConverter<T>

  • Type Parameters:
    T - the type of the object to convert the XML Object into
    All Implemented Interfaces:
    InputConverter<T>

    public class XmlInputConverter<T>
    extends InputStreamInputConverter<T>
    An InputConverter that converts a XML Object read from an InputStream into an object.
    • Constructor Detail

      • XmlInputConverter

        public XmlInputConverter​(Class<T> targetClass)
        Construct a new instance of a XmlInputConverter that is able to convert the data read from the InputStream into objects of the specified targetClass.
        Parameters:
        targetClass - The class defining the objects being converted from XML.
      • XmlInputConverter

        public XmlInputConverter​(Class<T> targetClass,
                                 String tag)
        Construct a new instance of a XmlInputConverter that is able to convert the data read from the InputStream into objects of the specified targetClass. Often, the XML returned by web services has the relevant information nested or wrapped in rootnodes. If there is a 1-1 mapping between the data and the Object, we would end up with unused wrapper classes. By specifying the name of the node that contains the relevant information, the wrapping data is ignored.
        Parameters:
        targetClass - The class defining the objects being converted from XML.
        tag - the nodename of the rootnode containing the relevant information.
    • Method Detail

      • read

        public T read()
        Description copied from interface: InputConverter
        Reads an object from a certain input source and returns it.
        Returns:
        An object read from a certain input source.