Hi all, recently, there was a discussion about extending the [csv] interface to provide data conversions to different types. If such a use case is to be supported, what would be the best approach to integrate a library like [convert]? Doing all required conversions manually would probably mean a bunch of boilerplate code, wouldn't it?
I had an idea how to automate this use case. Given an interface with a method T getValue(...); where T is some base type like String or Object. Now we want to provide other methods like int getValueAsInt(...); long getValueAsLong(...); ... If there is an extended interface with all getValueAsXXX() methods, couldn't the conversion be done by a proxy? The invocation handler would obtain the return type of the invoked method in order to determine the target class of the conversion. It would then call the basic getValue() method with the provided arguments, convert the result, and return it. This is the general idea, in practice probably some filtering would be needed to react only on certain method invocations. Do you think this use case is generic enough to support it in [convert] (e.g. by providing an abstract base class of an invocation handler and some convenience methods for creating proxy objects)? Oliver --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org