Hi Jörg,

> Since Optional is an abstract class ... how do you instantiate it
> "directly"?

That was the confusing part: I don't actually use the "Optional" from
Guava myself, I have my own Optional class which isn't abstract. It's
just a container of a reference to the given type.

> The question is simply, if the value from "getRequiredType()" is acquired by
> the parent converter with "Bar.class.getDeclaredField("myField1").getType()"
> in the end. Then you should be able to deduce the generic type.

My question is then: shouldn't the parent converter use
getGenericType() instead of getType()?
getType() returns a class, so for a declared field Optional<String>,
it will only give me "Optional"; from getGenericType(), I would have
been able to get the "String" part as well.

> IMHO you have only two reliably possibilities. Either write the type of the
> value into an own attribute or use multiple instances of your converter, let
> them take the type as constructor argument and register those converters as
> local ones individually.

Thanks for the suggestion. The multiple instances alternative sounds
doable for me.

cheers,
Remko

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to