As a part of the process of component commissioning, the Metro runtime may be requested to build and populate a context object fulfilling the component runtime dependencies. Solutions to dependency constraints can be resolved by direct value construction or by reference to existing services. The Services annotation provides the mechanisms for a component class to declare the set of service interfaces it whishes to publish towards other components. In the absence of the Service annotation a component class is evaluated in its raw form (i.e. X isAssignableFrom Y).
value | An array of interface classes. |
The following code demonstrates the use of the Services annotation to restrict services to the single Replicator service interface.
import net.dpml.annotation.Services; @Services( Replicator.class ) public class DefaultReplicator implements Replicator, Serializable, Comparable { ... }