Package com.atlassian.jira.projects.util
Class OptionalServiceAccessor<T>
java.lang.Object
com.atlassian.jira.projects.util.OptionalServiceAccessor<T>
- Direct Known Subclasses:
OnboardingServiceAccessor
An optional service accessor allows you to access an underlying component service in an optional manner. If the
service is not present, you can know and if it is present then you can use it
This is designed for you to derive a simple @Component class from that names the OSGI service name that backs this
object.
\@ Component
class SomeServiceAcessor extends OptionalServiceAccessor<SomeService> {
public SomeServiceAcessor(final BundleContext bundleContext) {
super(bundleContext, "com.code.SomeService");
}
}
-
Constructor Summary
ConstructorsConstructorDescriptionOptionalServiceAccessor(org.osgi.framework.BundleContext bundleContext, String serviceClassName) -
Method Summary
-
Constructor Details
-
OptionalServiceAccessor
public OptionalServiceAccessor(org.osgi.framework.BundleContext bundleContext, String serviceClassName)
-
-
Method Details
-
obtain
- Returns:
- a service reference object that knows if the service is available and how to get it
-