Hi Jörg,

> Since Optional is abstract, "myfield" must have been populated with a

Ah, I see that 'Optional' wasn't the best example. My version of
Optional isn't abstract, I directly
instantiate 'Optional<String>'.

You're right, I don't nest my output, so in my case,
  class Bar {
   Optional<String> myField1;
 }

becomes

  <Bar>
     <myField1>Hello, world!</myField1>
   </Bar>

> context.getRequiredType() should contain "OptionalString". And I am quite
> sure that you can find the generic type with:
>  Class optional=context.getRequiredType();
>  while(!Optional.class.equals(optional)) {
>    optional = optional.getSuperclass();
>  }
>  Class genericType = optional.getGenericType();

I would have hoped, but I don't think there is a 'getGenericType' on a
Class object, so I don't think I can get it from getRequiredType.
If I would indeed inherit from my Optional, I probably could have used
getGenericSuperclass() on the class.
I guess it would have also worked if getRequiredType() returned a Type
instead of a class?

thanks,
Remko

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

    http://xircles.codehaus.org/manage_email


Reply via email to