On Mon, Aug 24, 2009 at 2:25 AM, Alex
Shneyderman<[email protected]> wrote:
> I have config like this:
>
> public interface QrmEntityStoreConfig
> {
>
> Property<List<String>> types();
>
> }
>
> How, do I initialize it without marking types @Optional ?
Your question is incomplete.
Are you talking about a Service Configuration object?
If so, you should make it or another type a subclass of
ConfigurationComposite, and have a properties file with the same FQDN
as the service identifier (defaults to its ServiceComposite name).
Example;
package org.qi4j.entitystore.qrm;
:
public interface QrmEntityStoreConfig extends ServiceComposite
{
Property<List<String>> types();
}
:
public interface QrmEntityStoreService extends QrmEntityStore, ServiceComposite
{}
file; $CLASSPATH/org/qi4j/entitystore/qrm/QrmEntityStoreService.properties
# This file is read if no configuration is found in its visible store
types=abc,def,rst
Ahhhh... I just realized that you are probably asking about the fact
that it is a List...
If so, support for that has not been added. See
PropertyMapper.mapToType() which is lacking conversion from
non-discrete types. If you want to provide a patch, please do so. I
have opened a ticket for it; http://issues.ops4j.org/browse/QI-223 I
think it should make it to 1.0 so it is somewhat in a hurry.
Finally,
if you want to provide meta information to the Qrm ES, I think it
shouldn't be done via configuration, but via metaInfo() in bootstrap.
How does that work?
Well, you create whatever object graph you need to convey the mapping
to the ES, and then provide that object to the service declaration
during bootstrap;
module.addServices( QrmEntityStoreService.class ).setMetaInfo( yourobject );
which is available to the Mixins via an injected ServiceDescriptor.
@State private ServiceDescriptor descriptor;
Cheers
--
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java
I live here; http://tinyurl.com/2qq9er
I work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev