-->
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.  [ 2 posts ] 
Author Message
 Post subject: validator - custom field description w/o resources bundle
PostPosted: Thu May 29, 2008 1:35 am 
Newbie

Joined: Thu May 29, 2008 1:30 am
Posts: 4
Hi,

Does anyone know how to use the validator in such a way that you can programatically customize the description of the field without using a message resources bundle?

I know the name of the field at runtime.

For example

Code:
Acct valueObject = new Acct();
valueObject.setAccountNumber(new Long(-5));
classValidator.getInvalidValues(valueObject);




where accountNumber is defined as

Code:
@Min(value=0)
  private Long accountNumber;


and the error that is coming back is

Code:
accountNumber must be greater than or equal to 0


But what i really want is

Code:
myCustomDescription must be greater than or equal to 0


Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 29, 2008 1:40 am 
Newbie

Joined: Thu May 29, 2008 1:30 am
Posts: 4
i've answered my own question.

Where invalidMessage = validationMessages[0];
I was doing invalidMessage.toString() to get the message including the description, which was giving me the result above.

to get just the message without the description you need to do invalidMessage.getMessage.


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