Annotation Interface GenerateServiceFromMethod
The user-supplied annotation must have the following properties:
- Must only apply to methods (or classes also annotated with
)
invalid reference
Decorator - Must be available at runtime
- Must only be applied to interfaces marked with
Configured - May have one or zero String fields marked with
GeneratedServiceName
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:
- The implementation class will be as specified in this annotation
- The available contracts will be as specified in this annotation
- The scope will be as specified in this annotation
- If the user-supplied annotation has a field marked with
GeneratedServiceNameit will be the name in the descriptor - It will have a metadata entry with the name of the actual type of the List parameterized return type (or the single parametere type) with key METHOD_ACTUAL
- It will have a metadata entry with the name of the method with key METHOD_NAME
- It will have a metadata entry with the name of the parent
Configuredclass with key PARENT_CONFGIURED
If a class is annotated with a user-supplied annotation marked with this annotation then that
class *must* also be annotated with the
invalid reference
Decorateinvalid reference
Decorate
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:
- The implementation class will be as specified in this annotation
- The available contracts will be as specified in this annotation
- The scope will be as specified in this annotation
- The name will come from the field annotated with
GeneratedServiceNamefrom the user-supplied annotation defined by themethodinvalid reference
Decorate#with() - It will have a metadata entry with the
value with key METHOD_ACTUAL
invalid reference
Decorate#targetType() - It will have a metadata entry with the
value with key METHOD_NAME
invalid reference
Decorate#methodName() - It will have a metadata entry with the name of the parent
Configuredclass with key PARENT_CONFGIURED
- Author:
- jwells
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionString[]The set of fully qualified class names of the advertised contracts that are to be used in the generated descriptor.This must have the fully qualified class name of the implementation that is to be used in the generated descriptor -
Optional Element Summary
Optional Elements -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThis is the key in the metadata that will contain the actual type of the List return type of the method where the user-supplied annotation has been placedstatic final StringThis is the key in the metadata that will contain the name of the method where the user-supplied annotation has been placedstatic final StringThis is the key in the metadata that will contain the fully qualified class name of the class markedConfiguredthat contains this annotation
-
Field Details
-
METHOD_ACTUAL
This is the key in the metadata that will contain the actual type of the List return type of the method where the user-supplied annotation has been placed- See Also:
-
METHOD_NAME
This is the key in the metadata that will contain the name of the method where the user-supplied annotation has been placed- See Also:
-
PARENT_CONFIGURED
This is the key in the metadata that will contain the fully qualified class name of the class markedConfiguredthat contains this annotation- See Also:
-
-
Element Details
-
implementation
String implementationThis 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
String[] advertisedContractsThe 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
String scopeThe 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"
-