From: John C. <joh...@sa...> - 2003-03-04 21:03:49
|
Now I know what Rod was complaining about... in regards that the reply goes back to the user, not the list.. there must be a way to fix that. > -----Original Message----- > From: John Cavacas > Sent: Tuesday, March 04, 2003 12:27 PM > To: 'Tony Falabella' > Subject: RE: [Springframework-developer] purpose of code in > Errors.rejectValue() > > Tony, > > Thanks for the reply. > > That was my guess as well about the code property. But it also leads to > another question. > > The method signature is also includes the "message" parameter. So that is > point of having both "code" and "message" if the "code" would contain the > message? Do I perhaps not understand the intended use? > > In my tests the functionality seems to be working as expected (not > including the codes as I'm not currently using them). I'm using the > BindException implementation class to hold the errors for my domain object > validator. > > My original idea was to use this validator to perform syntactic and > semantic validation, but I've quickly realized that the only way this > validator can do that is if it has access to the business object, which in > my opinion it can't or shouldn't have. It seems that the validator > interface is really more suited for syntactic validation to occour for > example before the object is sent to the business method. The only way > that I can think of making that work is if somehow the validator object > and the business object had access to the same Errors object. To be more > specific... > > My validator object can check for example to see if an email address looks > like it is properly formatted. However I also need to know if this > particular email message already exists in my database because my business > rule dictates that there cannot be duplicate email addresses. In order for > the validator object to know that, it would have to ask the business > object to perform that look up, which in my opinion doesn't seem right. > > So my current solution is to perform the syntactic validation on the > validator, pass the domain object (a command) to the business method, and > let the business method perform the business rules, which in case of > problems would be expressed as typed exceptions. Does this make sense? Or > is there a way to actually make the validator perform both functions? > > Thanks, > John > > > > > -----Original Message----- > > From: Tony Falabella [mailto:ton...@ya...] > > Sent: Monday, March 03, 2003 8:58 PM > > To: joh...@sa...; springframework- > dev...@li... > > Subject: RE: [Springframework-developer] purpose of code in > > Errors.rejectValue() > > > > John, > > > > I believe the "code" field refers to an "ErrorCode" that could be used > > as a string value of an error msg that is associated with that Error. > > (Similar to a mainframe returning an error code when a bad message is > > returned to a user, only since it's a string it can actually be a bit > > descriptive for the user.) See the javadocs for the > > com.interface21.core.ErrorCoded interface for a detailed description. > > > > I am making some changes to the framework (then will pend review from > > Rod) to allowing ResourceBundles to be tied into a few things within the > > framework a little better. > > > > Right now, I believe the API to obtaining messages for anything in the > > framework is limited in 2 ways: > > 1) Does not allow parameters to be passed to it. > > 2) Some of the APIs do not allow a Locale to be passed into them (the > > Errors.rejectValue(...) is a good example. > > > > My changes should address both these issues. Also, I am attempting to > > add a subclass to the NestedException class (that merely calls a helper > > object) that will allow Exceptions themselves to obtain their messages > > from a ResourceBundle. I have this working now for myself, but wish to > > make a few changes to it to model the behavior of how log4j allows you > > to point various classes to various files (ie: Exceptions in this > > package look to this file for their msgs). I am a few days away from a > > code review on this. > > > > As far as answering your question about examples, I'm sorry but I don't > > have any examples to give you. > > > > > > -----Original Message----- > > From: spr...@li... > > [mailto:spr...@li...] On Behalf > > Of John Cavacas > > Sent: Monday, March 03, 2003 4:03 PM > > To: spr...@li... > > Subject: [Springframework-developer] purpose of code in > > Errors.rejectValue() > > > > I was wondering if someone, most likelly Rob, could tell me what the > > purpose of the String code parameter is in Errors.rejectValue(String > > field,String code,String message) method. > > > > And like my previous email "Validation usage examples and questions" i > > am looking for further clarification and proposed usage of the > > validation and DataBinding techniques in the framework. > > > > Thanks, > > John > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Etnus, makers of TotalView, The > > debugger > > for complex code. Debugging C/C++ programs can leave you feeling lost > > and > > disoriented. TotalView can help you find your way. Available on major > > UNIX > > and Linux platforms. Try it free. www.etnus.com > > _______________________________________________ > > Springframework-developer mailing list > > Spr...@li... > > https://lists.sourceforge.net/lists/listinfo/springframework-developer This communication is intended for the use of the individual(s) or entity it was addressed to and may contain confidential and/or privileged information. If the reader of this transmission is not the intended recipient, you are hereby notified that any review, dissemination, distribution or copying of this communication is prohibited. If you receive this communication in error, please notify the sender immediately and delete this communication from your system(s) to which it was sent and/or replicated to. (c) 2002 Sapiens Americas Corp. |