-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Parameter validation: access to parameter names
PostPosted: Mon Jan 12, 2009 3:39 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Great news about the parameters validation proposal. Just had a look at it, it looks great. We just finished implementing a very similar solution, so we'll try to refactor our code so that it gets closer to the proposal while waiting for the final spec.

Just one small thing about parameters validation that might be really related to the BeanValidation spec. Example with the following signature:

Code:
MyObject myMethod(OneType theType) { ... }


At the moment, by default, it's not possible to display something like "Validation error: parameter theType is null although it shouldn't". Because actually the parameter name is not accessible using the reflection API. So, what we currently display is just something like "Validation error: parameter n°1 is null although it shouldn't" which is less clear that the previous message, you'll agree.

I discovered this project: Paranamer that lets you workaround this by adding information into the bytecode after compilation, but it's not quite standard. It's said on this page that this information was initially scheduled to be added into JDK7, but finally wouldn't certainly go into because not enough time...

Maybe the priority of being able to access this information at runtime could be now put to a higher priority thanks to the new validation need/usefulness, isn't it?

Anyway, validation is a field that really needed some standardization and good practices. Thanks a lot for all this work.

Cheers
PS: current text copied from my comment on the Hibernate blog.

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2009 11:20 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Well, don't over-estimate Bean Validation, changing the course of Java 7 is a daunting task :)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2009 12:12 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Well, one can always dream :-).

Just thinking that as Bean Validation is being linked for example from the aquarium blog where there might be some experts involved in the JDK7 meta-spec (didn't check who were involved), adding something like this (parameter named added to bytecode, I mean) for the Bean Validation could also have helped.

Thanks anyway :-).

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.