DPML
DPML Metro Context Annotation
HomeUtilitiesStationMetro
Context Annotation

The Context annotation is used to mark an interface as compliant with the DPML Metro Context contract. During runtime evaluation of a class, the Metro system evaluates constructor arguments and builds solutions based on supplied deployment directives. During this process a constructor parameter may be evaluated to determin if it is a context-compliant interface. If no supporting annotation is present and the interface is an inner class of the component named Context, the runtime will assume that the interface is a context definition. While this pattern-based approach covers the majority of needs, there are circumstances where it is convinient to declare some other interface as the context definition. The context annotation provides this additional flexibility.

Sample Code

The following code declares that an interface is a context contract.

import net.dpml.annotation.Context;
    
@Context
public interface Configuration
{
    int getCount();
    Color getBackground( Color color );
    ...
    
}