Hi Marvin,

> > Property names are always String, values any type (therefore
> Map<String,?>).
> > With Java 5, integer props and so on are no "bad syntax" problem because
> of
> > autoboxing (no need to pass new Integer() or Integer.valueOf()).
> 
> Argument validation gets to be a headache when you pass around complex
> data
> structures.  It's doable, but messy and hard to grok.  Going through
> dedicated
> methods is cleaner and safer.
> 
> > Another good thing is, that implementors of e.g. XML config files like
> in
> > Solr, can simple pass all elements in config to this map.
> 
> I go back and forth on this.  At some point, the volume of data becomes
> overwhelming and it becomes easier to swap in the name of a class where
> most
> of the data can reside in nice, reliable, structured code.

See my second mail. The recently introduced Attributes and AttributeSource
would solve this. Each component just defines its attribute interface and
impl class and you pass in an AttributeSource as configuration. Then you can
do:

AttributeSource cfg = new AttributeSource();

ComponentAttribute compCfg = cfg.addAttribute(ComponentAttribute.class);
compCfg.setMergeScheduler(FooScheduler.class);

MergeBarAttribute mergeCfg = cfg.addAttribute(MergeBarAttribute.class);
mergeCfg.setWhateverProp(1234);
...
IndexWriter iw = new IndexWriter(dir, cfg);

(this is just brainstorming not yet thoroughly thought about).

Uwe



---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to