Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Method level validation question : propertyPath value
PostPosted: Wed May 06, 2009 6:40 pm 
Newbie

Joined: Fri Sep 21, 2007 11:55 am
Posts: 4
Hello,

About method level validation, what is the expected value for the attribute propertyPath (attribute of ConstraintViolation) when calling the method validateParameters ?

I've read appendix C - page 112 of bean_validation-1_0_CR1-pfd-spec.pdf - but didn't found anything).

Code:
<T> Set<ConstraintViolation<T>> validateParameters(Class<T> clazz, Method method, Object[] parameterValues,  Class<?>... groups)


For instance:
I have the method :
Code:
public void test (@NotNull String value)

if value is null, would I have :
    . propertyPath=value (name of the parameter - I don't think this can be done at least with JSE 6)
    . or propertyPath=0 (order of arguments)

Thanks !


Top
 Profile  
 
 Post subject: Re: Method level validation question : propertyPath value
PostPosted: Mon Jun 22, 2009 1:41 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7179
Location: Atlanta, USA
This was never fully specified unfortunately and the Appendix C will not make it as officially part of the spec :(
We have introduced the notion of Path and Node object instead of the string based propertyPath, things will be more open for extension in the future.
That being said you're right, getting the parameter name out of a class is not standard unfortunately.

_________________
Emmanuel
Check Hibernate Search in Action out


Top
 Profile  
 
 Post subject: Re: Method level validation question : propertyPath value
PostPosted: Sun Jul 12, 2009 5:09 am 
Newbie

Joined: Fri Jun 05, 2009 5:29 am
Posts: 4
In my implementation of method-level validation I set the property path string to be:

#<method-name>(<param1-simple-name>, <param2-simple-name>, ...)[<param-index>]

This seems to make pretty clear error messages.


Top
 Profile  
 
 Post subject: Re: Method level validation question : propertyPath value
PostPosted: Wed Jul 15, 2009 8:34 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7179
Location: Atlanta, USA
yes but how do you get param1-simple-name?

_________________
Emmanuel
Check Hibernate Search in Action out


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.