Moo icon indicating copy to clipboard operation
Moo copied to clipboard

Translate to Value Type

Open geoffreywiseman opened this issue 11 years ago • 5 comments

Moo doesn't really understand how to translate to value types; good support for this could be as simple as supporting constructors, although Moo should also come with the ability to handle at least all the wrapper types and very common value types within the JDK (String, Integer, Number, Float, Double, etc)

geoffreywiseman avatar Jun 07 '13 14:06 geoffreywiseman

What about a generic type converter which can take a source type and target type? Currently the ValueTypeTranslator can only take a target type

oliverzy avatar Oct 08 '13 03:10 oliverzy

A sort of configurable type coercion mechanism?

To some degree you can already do that with the mvel support for invoking methods, but I culd imagine generalizing, sure.

geoffreywiseman avatar Oct 08 '13 06:10 geoffreywiseman

oliverzy: Out of curiosity, why do you want the source type option? Are you expecting to have multiple source types that translate to the same destination type?

geoffreywiseman avatar Oct 08 '13 14:10 geoffreywiseman

Yes, you are right, Geoffrey. That's what I am expecting.

oliverzy avatar Oct 08 '13 14:10 oliverzy

The basics of this are in place now with ValueTypeTranslator in v2.0; shouldn't be too hard to extend this further.

geoffreywiseman avatar May 15 '14 01:05 geoffreywiseman