@ SuppressWarnings ( "unchecked" ) @ NotNull public < TYPE > TYPE create ( @ NotNull final Reader reader , @ NotNull final JAXBContext jaxbContext ) throws UnmarshalObjectException { Contract . requireArgNotNull ( "reader" , reader ) ; Contract . requireArgNotNull ( "jaxbContext" , jaxbContext ) ; try { final Unmarshaller unmarshaller = jaxbContext . createUnmarshaller ( ) ; final TYPE obj = ( TYPE ) unmarshaller . unmarshal ( reader ) ; return obj ; } catch ( final JAXBException ex ) { throw new UnmarshalObjectException ( "Unable to parse XML from reader" , ex ) ; } }
Creates an instance by reading the XML from a reader .