org.xwiki.component.annotation
Annotation Type Requirement


@Documented
@Retention(value=RUNTIME)
@Target(value=FIELD)
@Inherited
public @interface Requirement

Defines a field or method that needs to be injected with a component. A hint can be specified to choose which implementation to use.

Since:
1.8.1
Version:
$Id: Requirement.java 33202 2010-11-30 16:48:43Z tmortagne $

Optional Element Summary
 java.lang.String[] hints
          When injecting a Collection of requirements, allows specifying a discrete list of hints to use.
 java.lang.Class<?> role
          Deprecated. since 2.7RC1 generic types are guessed too
 java.lang.String value
          The hint value selecting a specific component implementation to use.
 

value

public abstract java.lang.String value
The hint value selecting a specific component implementation to use.

Default:
""

role

@Deprecated
public abstract java.lang.Class<?> role
Deprecated. since 2.7RC1 generic types are guessed too

The role for the component to inject. Note that the role can usually be guessed from the field type or method parameter type. However, for Lists or Maps we need to pass it since Java doesn't allow getting it using reflection.

Default:
java.lang.Object.class

hints

public abstract java.lang.String[] hints
When injecting a Collection of requirements, allows specifying a discrete list of hints to use. If these are not specified, then all implementations for the specified role will be injected.

Default:
{}


Copyright © 2004-2011 XWiki. All Rights Reserved.