James Carman wrote:
I put in a Bugzilla request for an IndexTransformer class.  Basically, it
just returns the value from the input (input can be List, array, String, or
StringBuffer) at a specified index.
We already have a CollectionUtils method for getting the indexed object from a List/Map/Array etc.

 We've used a similar class in our
application when we want to put the values from a query result (Collection
of Object[]) into a map.  We do something like this...

public void populateMap( Map map, Collection objects, Transformer
keyTransformer, Transformer valueTransformer );

And, you'd use it like this (assuming we did something like select x.id,
x.name from SomeClass x)...

populateMap( map, queryResults, new IndexTransformer(0), new
IndexTransformer(1));

Do you think I could also add the populateMap method (there's another flavor
of it that just uses the object itself as the value using a no-op
transformer)?
The populateMap methods definitely look useful and should be added.

The transformer is just one of many, many transformers that could be added. The problem is when to stop, see new thread.

Stephen


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to