org.jvnet.hk2.annotations
Annotation Type Contract


@Documented
@Retention(value=RUNTIME)
@Target(value={TYPE,ANNOTATION_TYPE})
public @interface Contract

Marker annotation to allow implementations to be discovered from the contract they implement.

There are two usages of this annotation.

Contract interface

This annotation can be placed on interfaces and abstract classes T, and derived classes that are assignable to T with Service annotation can be looked up by using Habitat.getByContract(Class) (and its family of methods.)

Contract annotation

This annotation can be used as a meta-annotation on another annotation (let's say X), along with Index annotation on one of its property. What happens in this case is that when X is placed on classes, those classes will be marked as implementations of the contract.

Author:
Jerome Dochez
See Also:
Index



Copyright © 2010 Oracle Corporation. All Rights Reserved.