I came up with this "useless" class because I wanted to isolate the
logic of converting values in one place. Since there wasn't a ton of
feedback with it at the time I added I figured that people would
probably have issues with it at some point, so isolating the logic
seemed like a good idea. I guess I could have perhaps done it with
another method in a super class or something... Regardless I am fine
with getting rid of it if its not useful.
-Justin
Andrea Aime wrote:
> Hi,
> in this mail I'm questioning the usefullness of the above
> class. The class is so small that I can paste its contents here:
>
> public class Value {
> Object value;
> public Value(Object value) {
> this.value = value;
> }
> public Object getValue() {
> return value;
> }
> public void setValue(Object value) {
> this.value = value;
> }
> public Object value(Class context) {
> if (context.isInstance(value))
> return value;
>
> return Converters.convert(value, context);
> }
> }
>
> There is quite a bit of places that creates a Value object
> and then just calls Value.getValue()... what about using
> your value directly, instead of uselessly wrapping it in
> another object?
> The other significat bit of users do create a Value to
> apply the conversion method... wouldn't it be better to
> have a new method in Converters that does the same at the value(Class
> context) method and use that one directly? (we could add
> the check directly to Converters.convert(value, context) but
> given the cost of context.isInstance it's probably better
> to have a separate method, that is, pay the cost of an
> isInstance check only if strictly needed.
>
> All in all, it seems to me the net effect of Value is
> to create more garbage in the heap, but I don't get its
> value as a coding tool...
>
> Cheers
> Andrea
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Geotools-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
--
Justin Deoliveira
The Open Planning Project
[EMAIL PROTECTED]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel