• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Which validation framework to use?

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In our web service project we are looking for a validation framework on java objects.
I tried iscreen which is pretty good but it does not have a maven repository. (Not sure if the code is production ready)
Tried spring validator which does not have much validations.
Tried using commons validator which did not look comfortable.
Tried JSR 303, they have only annotation based validation. Our beans are jaxb generated so we cannot put custom annotations. We can do it but its very hard.
We cannot use XSD schema validation before converting to jaxb objects because we accept both XML and JSON's as Input. (Wanted to convert JSON object to XML again for validation but its not a recommended architecture).

Any other alternatives???
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I still think JSR-303 is the way to go. The framework to use for that is Hibernate Validator

Now my first choice would be don't generate the Jaxb objects. In my opinion a lot of Object factories and unnecessary meta data is generated with it. Create your objects and annotate them how you want them then they can easily be used for XML and JSON as well as adding the JSR-303 annotations to them.

If you decide that you want to keep generating the objects you can either map them to JSR-303 annotated objects using a mapping library like Dozer or you can use xml to apply the JSR-303 rules to your generated objects and just use the generated objects themselves. See the documentation for that HERE.
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out OVal (stands for Object Validation):

http://oval.sourceforge.net/

Configuration can be applied using XML or annotations.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try Java Validation Framework that located in maven central.
 
I love a good mentalist. And so does this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic