Reputation: 604
I try to expose the following method as a web service
public void validate(Foo foo) throws javax.validation.ConstraintViolationException;
The problem is ConstraintViolationException
embeds a Set
of javax.validation.ConstraintViolation
which is an interface. I use hibernate-validator
as javax.validation API implementation.
As is, JAXB can't handle interface. I'm stuck on mapping org.hibernate.validator.engine.ConstraintViolationImpl
to ConstraintViolation
at runtime.
Obviously, the only code I can change is my Web service.
How can I defined, in this context, the set of implementation I want to use for all the interface I have?
Thanks
Upvotes: 3
Views: 381
Reputation: 54074
What you are doing is bad practice.
You should not be returning or throwing for that matter any Java
specific objects.
You should only expose interfaces that can be "translated" to any platform.
Upvotes: 1