This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Please review my criteriaFind method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Please review my criteriaFind method" Watch "Please review my criteriaFind method" New topic
Author

Please review my criteriaFind method

Sergei Simonov
Greenhorn

Joined: Dec 20, 2002
Posts: 3
Hi there
Please review and comment my criteriaFind method implementation.
fieldMap - HashMap contains field name as the Key and order number of it as the value.

[ December 20, 2002: Message edited by: Junilu Lacar ]
Mag Hoehme
Ranch Hand

Joined: Apr 07, 2002
Posts: 194
Hi Sergei,
if it works, it is ok.
However, I find your method somewhat long. I stuffed all this parsing and matching into a separate class, thus encapsulating it.
As a rule of thumb: your methods should be so long that you can view them on the screen without scrolling. If your methods are longer than that, consider refactoring them.
Besides, I used two tokenizers, one for separating the key-value pairs, and the other one for separating the key from the value. Instead of putting all possible delimiters into one string you could use the nextToken(String delim) method.
Hope this helps.


Mag
 
 
subject: Please review my criteriaFind method
 
Similar Threads
criteriaFind().. implementation
suncertify.db.Data
about criteriaFind
FBN: criteriaFind(String criteria) method; is this ok ?
How to do exact match in criteriaFind?