views:

191

answers:

2

Does anybody know of a good common frameworks for Java that has common but tedious utility methods that do things like...

ObjectUtil.equalsOrBothNull(obj1,obj2)

FormatUtil.formatName(String firstName String middleName, String lastName) 

AddressUtil.formatAddress(address)

etc...

It seems like I always end up re-implementing these sorts of classes. Guava-libraries is the closest thing I have found.

http://code.google.com/p/guava-libraries/

+6  A: 

Commons Lang has a lot of utilities that you might find helpful. I use that library in most of my projects. This page has a basic overview of the different classes. StringUtils is the one that I use most, but many of the others have been handy once or twice. ObjectUtils has the null-safe equals method you're looking for.

Kaleb Brasee
+1 for Commons Lang (and Commons IO). The OP asked for a "modern" library, I suppose that means support for generics and annotations. Not an issue for Commons Lang (not there, but not needed), but Commons Collections is getting a bit dusty without generics.
Thilo
@Thilo: There's a generic-ised port of Commons Collections at http://larvalabs.com/collections/
skaffman
The next versions of nearly all commons components are going to be genericised, just so you know
Valentin Rocher
+3  A: 

You may also find hamcrest useful.

http://code.google.com/p/hamcrest/

Here is the tutorial: http://code.google.com/p/hamcrest/wiki/Tutorial

nanda