Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public <T>Optional<T> parse(String fileString, Class<T> someClass) {
- File file = new File(fileString);
- T newClass = null;
- try {
- JAXBContext jaxbContext = JAXBContext.newInstance(ТУК ТРЯБВА ДА ПОДАМ КЛАСА T AMA NZ KAK);
- Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
- newClass = (T) jaxbUnmarshaller.unmarshal(file);
- } catch (JAXBException e) {
- e.printStackTrace();
- }
- return (Optional<T>) Optional.ofNullable(newClass);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement