-->
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.  [ 4 posts ] 
Author Message
 Post subject: @Pattern and flag parameter
PostPosted: Wed Aug 08, 2007 4:40 pm 
Beginner
Beginner

Joined: Sat Jul 29, 2006 12:29 am
Posts: 27
Hi,

I've been looking for @Pattern examples to understand how they work without success. I also already read Hibernate Validator reference guide.

Could someone help me with some questions?

1) How I am supposed to use @Pattern with "flag=" parameter. What goes at flag parameter? Any example? I am trying to validate different postal codes formats from different countries.

2) @Patterns will validate all patterns? If the field matches one of them will Validator return true?

3 ) Could someone from Validator team update the reference guide with examples cause I think this is a powerful resource?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 09, 2007 9:47 am 
Beginner
Beginner

Joined: Sat Jul 29, 2006 12:29 am
Posts: 27
Ok.

flag must be one of the constants defined here...

http://java.sun.com/j2se/1.4.2/docs/api ... ttern.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 09, 2007 10:12 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
If you want an OR, you'll have to write you custom validator, which shouldn't be hard. Plus it's going to be more explicit
@ZipCode
public String zipCode;

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 10:17 am 
Beginner
Beginner

Joined: Sat Jul 29, 2006 12:29 am
Posts: 27
Thanks Emmanuel.


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