Re: [picocontainer-dev] ConfigParameterTestCase / ConfigParameter

Jörg Schaible <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
Hi Paul,

Paul Hammant wrote:

> Well I have the following ....

[snip]

so we would have instead:

private static final Map<Class, ParameterFactory>
  stringConverters = new HashMap<Class, ParameterFactory>();
static {
    stringConverters.put(Integer.class, 
        new ValueOfParameterFactory<Integer>();
    stringConverters.put(Double.class, 
        new ValueOfParameterFactory<Double>();
    stringConverters.put(Boolean.class, 
        new ValueOfParameterFactory<Boolean>();
    stringConverters.put(Long.class, 
        new ValueOfParameterFactory<Long>();
    stringConverters.put(File.class, 
        new StringConstructorParameterFactory<File>();
    ...
}

We might find better names for the classes though. We may collect them in an
own package.

> ... inside BasicComponentParameter.  Its not so generified, but we
> don't need the provides() method as the key to the map, is the clue
> to whether it can do it or not. Its a shame that each of those inner 
> classes is 800 bytes or so.

Well, here we have no inner classes anymore.

> I think for now, a fixed list of conversions is fine - going up to
> the set that XStream caters for.

You can only use the SingleValueConverters anyway and with the generified
versions from my last posting, you can handle quite a lot.
 
> Later on we could have DPC.addTypeConverter(..) at an instance level.
> 
> Thoughts?

- Jörg



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

    http://xircles.codehaus.org/manage_email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.