Package org.atlanmod.commons.service
Class OSGiContext
- java.lang.Object
-
- org.atlanmod.commons.service.OSGiContext
-
- All Implemented Interfaces:
ServiceContext
@ParametersAreNonnullByDefault public class OSGiContext extends Object implements ServiceContext
AServiceContextable to retrieve OSGi Declarative Services from aBundleContext. NOTE: This context is automatically loaded and configured when this bundle is starting under an OSGi environment.
-
-
Constructor Summary
Constructors Constructor Description OSGiContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <S> Stream<ServiceDefinition<S>>getServices(Class<S> type)Retrieves all registered services of the specifiedtype.<T> Stream<ServiceDefinition<T>>getServices(Class<T> type, String filter)Retrieves all registered services of the specifiedtype.
-
-
-
Method Detail
-
getServices
@Nonnull public <S> Stream<ServiceDefinition<S>> getServices(Class<S> type)
Description copied from interface:ServiceContextRetrieves all registered services of the specifiedtype.- Specified by:
getServicesin interfaceServiceContext- Parameters:
type- the type of services to look for- Returns:
- a parallel stream of all registered services of the specified
type
-
getServices
@Nonnull public <T> Stream<ServiceDefinition<T>> getServices(Class<T> type, @Nullable String filter)
Retrieves all registered services of the specifiedtype.- Parameters:
type- the type of services to look forfilter- the filter to determine if a service should be returned- Returns:
- a parallel stream of all registered services of the specified
type
-
-