Annotation Type Service
ServiceLocator
. A service
marked with this annotation has the default scope of Singleton
,
but any other scope annotation placed on the class will override that default.
This annotation is read at build time using the hk2-inhabitant-generator
and information about the service is placed into a file in the
associated jar. The usual way to get these services into
a ServiceLocator
is to use a
Populator
as provided by the
DynamicConfigurationService.getPopulator()
method. An easier way to do that is with the
ServiceLocatorUtilities.createAndPopulateServiceLocator()
utility.
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
name
String nameName of the service.ServiceLocator.getService(Class, String, java.lang.annotation.Annotation...)
and similar methods can be used to obtain a service with a particular name.The default value "" indicates that the inhabitant has no name.
- Default:
""
-
metadata
String metadataAdditional metadata that goes into the inhabitants file. The value is "key={value},key={value1,value2,...},..." format. This information is accessible fromDescriptor.getMetadata()
.While this is limited in expressiveness, metadata has a performance advantage in it that it can be read without even creating a classloader for this class. For example, this feature is used by the configuration module so that the config file can be read without actually loading the classes.
- Default:
""
-
analyzer
String analyzerThe name of theClassAnalyzer
service that should be used to analyze this class- Returns:
- The name of the
ClassAnalyzer
service that should be used to analyze this class
- Default:
"default"
-