i have a prob with a cast
JAXBElement<User> jaxbElement = (JAXBElement<User>)unmarshaller.unmarshal(sr);
It's doesn't work , eveybody can help me ?
I can't do this : i show you my code :
StringReader sr = new StringReader(this.message);
JAXBElement<Utilisateur> jaxbElement = (JAXBElement<Utilisateur>) unmarshaller.unmarshal(sr);
if I do this, I have an error because i Use a StringReader :
JAXBElement<User> jaxbElement = unmarshaller.unmarshal(sr, User.class);
If you want to avoid the compiler warning you can use one of the unmarshal methods that takes a Class
parameter.
JAXBElement<User> jaxbElement = unmarshaller.unmarshal(sr, User.class);
Note
Your code should run perfectly fine as you have it in your question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With