Hi,
To start with I propose to model against the plexus annotations but
more simple:
* Component
* Requirement
* Configuration
/**
* Marks a class as a XWiki component.
*/
@Documented
@Retention(RUNTIME)
@Target(TYPE)
@Inherited
public @interface Component
{
Class<?> role();
String hint() default "";
String instantiationStrategy() default "";
}
/**
* Configures a requirement.
*/
@Documented
@Retention(RUNTIME)
@Target({ FIELD, METHOD })
@Inherited
public @interface Requirement
{
Class<?> role() default Object.class;
String hint() default "";
//
// HACK: This is here to support component requirement lists,
which can take a list of hints
//
String[] hints() default {};
}
Note: not sure yet why plexus says it's a hack.
/**
* Marks a field as a configuration element with a default value.
*/
@Documented
@Retention(RUNTIME)
@Target(FIELD)
@Inherited
public @interface Configuration
{
String name() default "";
String value();
}
So for example in the code you'd have:
@Component(role=Parser.class)
public class WikiModelXWikiParser implements Parser...
{
@Requirement
private LinkParser linkParser;
....
wdyt?
I'm still researching.
Thanks
-Vincent