private List < ? > loadDataFromXmlFile ( ) { logger . entering ( ) ; Preconditions . checkArgument ( resource . getCls ( ) != null , "Please provide a valid type." ) ; List < ? > returned ; try { JAXBContext context = JAXBContext . newInstance ( Wrapper . class , resource . getCls ( ) ) ; Unmarshaller unmarshaller = context . createUnmarshaller ( ) ; StreamSource xmlStreamSource = new StreamSource ( resource . getInputStream ( ) ) ; Wrapper < ? > wrapper = unmarshaller . unmarshal ( xmlStreamSource , Wrapper . class ) . getValue ( ) ; returned = wrapper . getList ( ) ; } catch ( JAXBException excp ) { logger . exiting ( excp . getMessage ( ) ) ; throw new DataProviderException ( "Error unmarshalling XML file." , excp ) ; } logger . exiting ( returned ) ; return returned ; }
Generates a list of the declared type after parsing the XML file .