org.apache.felix.scr.annotations
Annotation Type Component


@Target(value=TYPE)
@Retention(value=SOURCE)
public @interface Component

The Component annotation is the only required annotation. If this annotation is not declared in a Java class, the class is not declared as a component.

This annotation is used to declare the <component> element of the component declaration. See section 112.4.3, Component Element, in the OSGi Service Platform Service Compendium Specification for more information. The required <implementation> element is automatically generated with the fully qualified name of the class containing the Component annotation.


Optional Element Summary
 boolean componentAbstract
          This marks an abstract service description which is not added to the descriptor but intended for reuse through inheritance.
 boolean configurationFactory
          Set the metatype factory pid property (only for non factory components).
 boolean createPid
          Generated service.pid property by default, if none declared explicitly.
 String description
          This is generally used as a description for the object described by the meta type.
 boolean ds
          Whether Declarative Services descriptor is generated or not.
 boolean enabled
          Whether the component is enabled when the bundle starts.
 String factory
          Whether the component is a factory component.
 boolean getConfigurationFactory
          Deprecated. Use configurationFactory()
 boolean immediate
          Whether the component is immediately activated.
 boolean inherit
          Whether any service, property and reference declarations from base classes should be inherited by this class.
 String label
          This is generally used as a title for the object described by the meta type.
 boolean metatype
          Whether Metatype Service data is generated or not.
 String name
          Defines the Component name also used as the PID for the Configuration Admin Service.
 ConfigurationPolicy policy
          The configuration policy
 String specVersion
          The version of the Declarative Services specification against which the component is written.
 

name

public abstract String name
Defines the Component name also used as the PID for the Configuration Admin Service. Default value: Fully qualified name of the Java class.

Default:
""

label

public abstract String label
This is generally used as a title for the object described by the meta type. This name may be localized by prepending a % sign to the name. Default value: %<name>.name

Default:
""

description

public abstract String description
This is generally used as a description for the object described by the meta type. This name may be localized by prepending a % sign to the name. Default value: %<name>.description

Default:
""

enabled

public abstract boolean enabled
Whether the component is enabled when the bundle starts.

Default:
true

factory

public abstract String factory
Whether the component is a factory component.

Default:
""

immediate

public abstract boolean immediate
Whether the component is immediately activated.

Default:
false

inherit

public abstract boolean inherit
Whether any service, property and reference declarations from base classes should be inherited by this class.

Default:
true

metatype

public abstract boolean metatype
Whether Metatype Service data is generated or not. If this parameter is set to true Metatype Service data is generated in the metatype.xml file for this component. Otherwise no Metatype Service data is generated for this component.

Default:
false

componentAbstract

public abstract boolean componentAbstract
This marks an abstract service description which is not added to the descriptor but intended for reuse through inheritance. This attribute defaults to true for abstract classes and false for concrete classes.

Default:
false

ds

public abstract boolean ds
Whether Declarative Services descriptor is generated or not. If this parameter is not set or set to true the Declarative Services descriptor is generated in the service descriptor file for this component. Otherwise no Declarative Services descriptor is generated for this component.

Default:
true

specVersion

public abstract String specVersion
The version of the Declarative Services specification against which the component is written. Generally, the Maven SCR Plugin is able to automatically detect which specification version a Component is written against. There are some cases, though, where this is not easily or reliably possible. In these cases use this attribute to force the specification version.

Valid values currently are 1.0 and 1.1. If an unsupported value is declared, a descriptor failure results.

Since:
1.0.1
Default:
"1.0"

createPid

public abstract boolean createPid
Generated service.pid property by default, if none declared explicitly.

Default:
true

getConfigurationFactory

public abstract boolean getConfigurationFactory
Deprecated. Use configurationFactory()

Set the metatype factory pid property (only for non factory components).

Since:
1.0
Default:
false

configurationFactory

public abstract boolean configurationFactory
Set the metatype factory pid property (only for non factory components).

Since:
1.3
Default:
false

policy

public abstract ConfigurationPolicy policy
The configuration policy

Since:
1.0
Default:
org.apache.felix.scr.annotations.ConfigurationPolicy.OPTIONAL


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.