org.apache.beehive.controls.api.context
Annotation Type Context


@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface Context

The Context annotation type is used to annotate a field within a control implementation class that refers to a contextual service. The Java Controls runtime will automatically initialize the field value to an appropriate provider of the requested service, or will throw a construction or deserialization error if no such provider is available. The following is a simple example:

 @ControlImplementation
 public class MyControlImpl
 {
     @Context
     ControlContext myContext;
 }
 
This example declares a field named myContext that will automatically be initialized by the Java Controls runtime to refer to a provider of the ControlContext contextual service.