RE: [picocontainer-dev] Specify a zero arg constructor?
Jörg Schaible <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Michael,
Michael Rimov wrote:
> Hi All,
>
> I've got an issue with the following code:
>
> MutablePicoContainer pico = new DefaultPicoContainer();
> pico.addComponent(ArrayList.class, ArrayList.class);
> pico.addComponent(HashSet.class);
> assertNotNull(pico.getComponent(ArrayList.class)); //Error!
>
> The following claims a circular dependency exception...
> simple enough....
> because ArrayList can have a ArrayList(Collection) constructor.
Uhhh. This was solved in Pico 1.x! A component could not be used for a self-reference.
> Great.... now how can we specify the simple: new ArrayList() no arg
> constructor?
>
> In the past, we could:
>
> pico.addComponent(ArrayList.class, ArrayList.class,
> new Parameter[0]{});
>
> But that doesn't appear to be working. (I assume because of
> the variable arg
> constructors, it becomes impossible to tell if there was no parameter
> passed in, or an empty array)
>
> Any thoughts?
It should be possible to define the arguments ... even if their number is 0
:-/
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email