@Target(value={TYPE,ANNOTATION_TYPE})
public @interface Component
@Component
public class MyComponent {
// ...
}
But, it is also possible to have it associated to a
stereotyped annotation definition:
@Component
@Instantiate
@Stereotype
public @interface AutoInstantiatedComponent {
// ...
}
Modifier and Type | Optional Element and Description |
---|---|
boolean |
architecture
Enable / Disable the architecture exposition (no
Architecture
service will be exposed for component's instances). |
java.lang.String |
factory_method
Deprecated.
now is called factoryMethod.
|
java.lang.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.
|
java.lang.String |
managedservice
Set the Managed Service PID for Configuration Admin.
|
java.lang.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).
|
java.lang.String |
version
Set the version of the component type.
|
public abstract boolean public_factory
publicFactory()
public abstract boolean publicFactory
Factory
service.
Only instances declared in the same bundle are created.
@Component(publicFactory = false)
public class MyComponent {
// ...
}
Default: truepublic abstract java.lang.String name
@Component(name = "my-component")
public class MyComponent {
// ...
}
Default : implementation class name.public abstract boolean architecture
Architecture
service will be exposed for component's instances).
@Component(architecture = false)
public class MyComponent {
// ...
}
Default : truepublic abstract boolean immediate
@Component(immediate = true)
@Provides
public class MyComponent implements MyService {
// ...
}
Default : falsepublic abstract boolean propagation
@Component(propagation = false)
public class MyComponent {
// ...
}
default: truepublic abstract java.lang.String managedservice
@Component(managedservice = "my.Pid")
public class MyComponent {
// ...
}
public abstract java.lang.String factory_method
factoryMethod()
public abstract java.lang.String factoryMethod
@Component(factoryMethod = "createInstance")
public class MyComponent {
// ...
public static MyComponent createInstance() {
return new MyComponent("some static configuration");
}
}
Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved.