[Opensource] SimpleDateFormat

Michael Rimov rimovm at centercomp.com
Tue Mar 11 15:20:13 PST 2003


At 02:37 PM 3/11/2003 -0500, you wrote:
>Good day all.
>
>I've been contemplating how best to format dates on an application wide
>basis.  What I've done is as follows:

Ben,

Instead, why don't you create a wrapper object that wraps a DBObject to get 
what you want.  By implementing a quick 'factory' method, you could end up 
with code like so:

WrapperObject wrap = WrapperObject.wrap(DBObject obj);
String formattedDate = wrap.getDateField(String fieldName);

Something along these lines would give you two advantages:

1 - Proper division of labor.  The wrapper does what it's supposed to... 
which is provide date formatting.

2 - We avoid yet more methods in DBObject, which I'm trying to split up anyway.

3 - No patching the code while you wait for it to show up in CVS :)

Does this help?
                                                         -Mike





More information about the Opensource mailing list