Hi,

[email protected] wrote:

> Thanks Jörg!
> 
> Let me just ask you one last question concerning a behavior from which I'm
> not sure if it is correct:
> 
> Given the following converter and a class using it for one of its
> properties:
> 
> public class MyConverter implements Converter {
>  public MyConverter(Class<?> clazz) {
>  ....
>  }
>  ....
> }
> 
> class MyObject {
>  @XStreamConverter(value=MyConverter.class, types=AnotherClass.class)
>  private MyClass prop;
> }
> 
> => My converter gets instantiated with "MyClass.class" as constructor
> argument! I would have thought that "AnotherClass.class" would be used
> since it is specified in the annotation. Is this expected behavior? Has
> the current type always priority?

Yes the current type has always priority. but it is only present if you use 
the annotation to annotate directly a type. If the annotation is part of a 
XStreamConverters (note the 's'), then the current type is not delivered.

> Playing around a little but, I found out that, if I specify another
> constructor in my converter, taking two class instances, then the second
> argument will be "AnotherClass.class". Just not sure what are the exact
> rules for argument matching in converter constructors..

Constructors with the most arguments have priority. See the 
DependencyInjectionFactory for details (trunk is more recent).

> Thanks for throwing some light on this, Jörg!

Thanks for your questions. I actually improved Javadoc of the 
XStreamConverter now :)

Cheers,
Jörg


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

    http://xircles.codehaus.org/manage_email


Reply via email to