[hibernate-dev] [HV] Extending ParameterNameProvider contract for other element types

Gunnar Morling gunnar at hibernate.org
Mon Oct 7 03:49:08 EDT 2013


2013/10/2 Emmanuel Bernard <emmanuel at hibernate.org>

> But then the JSON binding technology should be responsible for the
> property anme conversion too, right? After all that is the layer that
> does this change.
>

Yes, the question then is how the layer could do the name change. It could
plug in an implementation of said SPI into HV, thus ensuring the constraint
violations already contain the "right" property names. Or it could do the
name changes when converting the violations into JSON. I guess both would
work one way or the other.



> On Thu 2013-09-19 10:35, Gunnar Morling wrote:
> > I also think that the conversion of the ConstraintViolation(s) into
> another
> > format is more in the responsibility of the integrating technology.
> >
> > Taking JAX-RS/Resteasy as example, it will transparently convert any
> > constraint violation objects into an equivalent XML or JSON response.
> > Provided we return the wished property name in the reported violation,
> > Resteasy's conversion would take over from there.
> >
> >
> > 2013/9/19 Hardy Ferentschik <hardy at hibernate.org>
> >
> > >
> > > On 19 Jan 2013, at 9:44 AM, Emmanuel Bernard <emmanuel at hibernate.org>
> > > wrote:
> > >
> > > > It seems that what this user really needs is a way to convert the
> > > Set<ConstraintViolation> into another format entirely, JSON in this
> case. I
> > > wonder if we could find a more generic approach than just the ability
> to
> > > change properties names.
> > >
> > > Well, there are really two problems. First the creation of the JSON
> format
> > > and then the property name "conversion". I think they need to be
> addressed
> > > separately. Even if we had/offered something to convert the constraint
> > > violations, we still
> > > would report the actual property name.
> > >
> > > In the described use case I would write the conversion code myself. The
> > > constraint violation contains all the information needed to create the
> JSON
> > > format and do the name conversion. It should not be hard to write.
> > >
> > > --Hardy
> > >
> > >
> > > _______________________________________________
> > > hibernate-dev mailing list
> > > hibernate-dev at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> > >
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list