@ SuppressWarnings ( "unchecked" ) @ NotNull public < TYPE > TYPE create ( @ NotNull @ FileExists @ IsFile final File file , @ NotNull final JAXBContext jaxbContext ) throws UnmarshalObjectException { Contract . requireArgNotNull ( "file" , file ) ; FileExistsValidator . requireArgValid ( "file" , file ) ; IsFileValidator . requireArgValid ( "file" , file ) ; Contract . requireArgNotNull ( "jaxbContext" , jaxbContext ) ; try { final FileReader fr = new FileReader ( file ) ; try { return ( TYPE ) create ( fr , jaxbContext ) ; } finally { fr . close ( ) ; } } catch ( final IOException ex ) { throw new UnmarshalObjectException ( "Unable to parse XML from file: " + file , ex ) ; } }
Creates an instance by reading the XML from a file .