Java Command Annotations – @Named
Table of Contents
Java command annotations are used for the developing Java commands in PAK.
This chapter describes the functionality of the @Named
annotation.
It also gives an example of how you can use this annotation in your implementation.
2. Properties
There is a String property value
defined for the @Named
annotation.
It defines the name for the service to be injected.
3. Usage
Listing 1 shows how to use the @Named
annotation.
Listing 1. Example usage of the
@Named
annotation/**
* @workflowDocu This command gets an element by its id.
*/
@JavaCommand
@CommandGroup("Element")
public class GetElement {
/**
* The build context service injected for this command
*/
@Named("builderContext") (1)
@Service
private IContext builderContext;
/**
* The interpreter context service injected for this command
*/
@Service
@Named("interpreterContext") (2)
private IContext interpreterContext;
[...]
}
1 | Definition of the service with name builderContext |
2 | Definition of the service with name interpreterContext |
Last updated 2024-07-05 11:16:52 +0200