org.jvnet.hk2.config
Annotation Type GenerateServiceFromMethod


@Documented
@Retention(value=RUNTIME)
@Target(value=ANNOTATION_TYPE)
public @interface GenerateServiceFromMethod

This annotation is put on user-supplied annotations in order to cause the hk2-inhabitant-generator tool to create descriptors with certain properties.

The user-supplied annotation must have the following properties:

Only methods of type java.util.List with a parameterized type (e.g. List) or which take a single parameter and a void return type may be annotated with the user-supplied annotation. The parameterized actual type (or the type of the parameter) will end up being used as a field in the descriptor. A single method may have multiple user-supplied annotations marked with this annotation, in which case a different descriptor will be generated for each user-supplied annotation.

When a method on an Configured interface has a user-supplied annotation that is annotated with this interface the hk2-inhabitant-generator will generate a service descriptor with the following properties:

If a class is annotated with a user-supplied annotation marked with this annotation then that class *must* also be annotated with the Decorate annotation. The Decorate annotation will provide the values for several of the fields as described below.

When a class on an Configured interface has a user-supplied annotation that is annotated with this interface the hk2-inhabitant-generator will generate a service descriptor with the following properties:

Author:
jwells

Required Element Summary
 String[] advertisedContracts
          The set of fully qualified class names of the advertised contracts that are to be used in the generated descriptor.
 String implementation
          This must have the fully qualified class name of the implementation that is to be used in the generated descriptor
 
Optional Element Summary
 String scope
          The scope that the descriptor should take.
 

Element Detail

implementation

public abstract String implementation
This must have the fully qualified class name of the implementation that is to be used in the generated descriptor

Returns:
The fully qualified class name of the implementation

advertisedContracts

public abstract String[] advertisedContracts
The set of fully qualified class names of the advertised contracts that are to be used in the generated descriptor. Note that the implementation class is not automatically added to this list

Returns:
The fully qualified class names of the advertised contracts the generated descriptor should take

scope

public abstract String scope
The scope that the descriptor should take. Defaults to PerLookup

Returns:
The fully qualified class names of the scope the descriptor should take
Default:
"org.glassfish.hk2.api.PerLookup"


Copyright © 2013 Oracle Corporation. All Rights Reserved.