jetbrains.buildServer
Interface ServiceLocator

All Known Subinterfaces:
ExtensionHolder, SBuildServer, ServerExtensionHolder, SpringContext
All Known Implementing Classes:
ServiceLocatorImpl, SpringSubContainerFactroyImpl.SpringContextImpl

public interface ServiceLocator

Locates services by their type


Method Summary
<T> T
findSingletonService(java.lang.Class<T> serviceClass)
          Searches for singleton service of specified type
<T> java.util.Collection<T>
getServices(java.lang.Class<T> serviceClass)
          Searches for all bean instances of type
<T> T
getSingletonService(java.lang.Class<T> serviceClass)
          Searches for singleton service of specified type
 

Method Detail

getSingletonService

@NotNull
<T> T getSingletonService(@NotNull
                                  java.lang.Class<T> serviceClass)
                      throws ServiceNotFoundException
Searches for singleton service of specified type

Parameters:
serviceClass - type of the service
Returns:
found service, never null
Throws:
ServiceNotFoundException - if specified service was not found or if more than one service found

findSingletonService

@Nullable
<T> T findSingletonService(@NotNull
                                    java.lang.Class<T> serviceClass)
Searches for singleton service of specified type

Parameters:
serviceClass - type of the service
Returns:
found service or null if there's no such service
Throws:
java.lang.RuntimeException - if more than one service found

getServices

@NotNull
<T> java.util.Collection<T> getServices(@NotNull
                                                java.lang.Class<T> serviceClass)
Searches for all bean instances of type

Parameters:
serviceClass - - type to search
Returns:
collection of classes that implements T