DPML
DPML Metro Component Annotation
HomeUtilitiesStationMetro
Component Annotation

The Component annotation binds a component name and runtime policies with a component class.

Attribute Table
name Associates a simple name to the component which may be used as a construction element in the creation of a fully qualified path. The default value is the empty string "".
lifestyle Associates an explicit lifestyle policy.
collection Associates an explicit collection policy.
lifecycle Declares a lifecycle graph via a fully qualified uri.
Sample Code

The following code binds the name widget, the lifestyle policy of SINGELTON, and a SOFT collection policy to the class SimpleWidget.

import net.dpml.annotation.Component;
    
import static net.dpml.annotation.CollectionPolicy.SOFT;
import static net.dpml.annotation.LifestylePolicy.SINGLETON;
        
@Component( name="widget", lifestyle=SINGLETON, collection=SOFT )
public class SimpleWidget
{
    ...
}
Technical Note

Features and policies assigned to a component (either via defaults or through an explicit component annotation) may be overriden by a packaged or part-based component strategy using the name, lifestyle, and collection attributes.