org.jvnet.hk2.annotations
Annotation Type Service


@Retention(value=RUNTIME)
@Target(value=TYPE)
@Documented
@InhabitantAnnotation(value="default")
public @interface Service

Marker interface for service implementation. A service is defined by an interface marked with the Contract annotation. Each service implementation must be marked with the @Service interface and implement the service interface.

Author:
Jerome Dochez, Kohsuke Kawaguchi
See Also:
Factory

Optional Element Summary
 java.lang.String analyzer
          The name of the ClassAnalyzer service that should be used to analyze this class
 java.lang.String metadata
          Additional metadata that goes into the inhabitants file.
 java.lang.String name
          Name of the service.
 

name

@Index
public abstract java.lang.String name
Name of the service.

org.glassfish.hk2.ContractLocator#named(String) and similar methods can be used to obtain a service with a particular name. All the named services are still available through org.glassfish.hk2.Services#byType(Class).

The default value "" indicates that the inhabitant is anonymous.

Default:
""

metadata

public abstract java.lang.String metadata
Additional metadata that goes into the inhabitants file. The value is "key=value,key=value,..." format. This information is accessible from org.glassfish.hk2.Descriptor#metadata().

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

public abstract java.lang.String analyzer
The name of the ClassAnalyzer 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"


Copyright © 2013 Oracle Corporation. All Rights Reserved.