org.apache.felix.ipojo.annotations

## Annotation Type Component

    @Target(value={TYPE,ANNOTATION_TYPE})
    public @interface Component

Declares a component type (needed to create instances of the component). This annotation is mandatory to declares an iPOJO component. Its usual to find it on top of class definition:

          @Component
         public class MyComponent {
             // ...
         }

But, it is also possible to have it associated to a stereotyped annotation definition:

          @Component
         @Instantiate
         @Stereotype
         public @interface AutoInstantiatedComponent {
             // ...
         }

## See also

- Use iPOJO Factories

Author:
  Felix Project Team

### Optional Element Summary

Optional Elements
`boolean` `architecture` Enable / Disable the architecture exposition (no `Architecture` service will be exposed for component's instances).
`String` `factory_method` Deprecated. now is called `factoryMethod`.
`String` `factoryMethod` Set the factory-method, if the pojo has to be created from a static method.
`boolean` `immediate` Set if the component is immediate.
`String` `managedservice` Set the Managed Service PID for Configuration Admin.
`String` `name` Set the component type name.
`boolean` `propagation` Enable or disable the configuration propagation to service properties.
`boolean` `public_factory` Deprecated. renamed to publicFactory.
`boolean` `publicFactory` Set if the component type is public or private (defaults to public).
`String` `version` Set the version of the component type.

### Element Detail

#### public_factory

    public abstract boolean public_factory

Deprecated. renamed to publicFactory.
Set if the component type is public.

See Also:
  `publicFactory()`

Default:
  true

#### publicFactory

    public abstract boolean publicFactory

Set if the component type is public or private (defaults to public). A private factory does not expose a `Factory` service. Only instances declared in the same bundle are created.

          @Component(publicFactory = false)
         public class MyComponent {
             // ...
         }

Default: true

Default:
  true

#### name

    public abstract String name

Set the component type name.

          @Component(name = "my-component")
         public class MyComponent {
             // ...
         }

Default : implementation class name.

Default:
  ""

#### architecture

    public abstract boolean architecture

Enable / Disable the architecture exposition (no `Architecture` service will be exposed for component's instances).

          @Component(architecture = false)
         public class MyComponent {
             // ...
         }

Default : true

Default:
  true

#### immediate

    public abstract boolean immediate

Set if the component is immediate. By default, iPOJO tries to be as lazy as possible and will create the POJO instance at the last possible time. Notice this setting is only effective when the component provides a service (@Provides).

          @Component(immediate = true)
         @Provides
         public class MyComponent implements MyService {
             // ...
         }

Default : false

Default:
  false

#### propagation

    public abstract boolean propagation

Enable or disable the configuration propagation to service properties.

          @Component(propagation = false)
         public class MyComponent {
             // ...
         }

default: true

Default:
  true

#### managedservice

    public abstract String managedservice

Set the Managed Service PID for Configuration Admin. default no PID (i.e. the managed service will not be exposed).

          @Component(managedservice = "my.Pid")
         public class MyComponent {
             // ...
         }

Default:
  ""

#### factory_method

    public abstract String factory_method

Deprecated. now is called `factoryMethod`.
Set the factory-method, if the pojo has to be created from a static method. The specified method must be a static method and return a pojo object. By default, iPOJO uses the 'regular' constructor.

See Also:
  `factoryMethod()`

Default:
  ""

#### factoryMethod

    public abstract String factoryMethod

Set the factory-method, if the pojo has to be created from a static method. The specified method must be a static method and return a pojo object. By default, iPOJO uses the 'regular' constructor.

          @Component(factoryMethod = "createInstance")
         public class MyComponent {
             // ...
             public static MyComponent createInstance() {
                 return new MyComponent("some static configuration");
             }
         }

Default:
  ""

#### version

    public abstract String version

Set the version of the component type.

          @Component(version = "1.3")
         public class MyComponent {
             // ...
         }

Default:
  ""