Package dev.getelements.elements.sdk
Interface ServiceLocator
- All Known Implementing Classes:
FilteredServiceLocator,GuiceServiceLocator
public interface ServiceLocator
Used to access instances which would otherwise be provided using the javax.getInstance annotations javax.injext.Inject and
javax.injext.Named.
Created by patricktwohig on 8/27/15.
-
Method Summary
Modifier and TypeMethodDescriptionfindInstance(ElementServiceKey<T> key) Gets the service using theElementServiceKey.findInstance(Class<T> tClass) Finds theSupplierto the supplied instance.findInstance(Class<T> tClass, String named) Finds theSupplierto the supplied instance.default <T> TgetInstance(ElementServiceKey<T> serviceKey) Gets the type of the service with the specific name.default <T> TgetInstance(Class<T> tClass) Gets the type of service, unnamed.default <T> TgetInstance(Class<T> tClass, String named) Gets the type of the service with the specific name.
-
Method Details
-
getInstance
Gets the type of service, unnamed.- Type Parameters:
T- the type ot getInstance- Parameters:
tClass- the type to getInstance- Returns:
- an injected instance of the supplied
Class<T>
-
getInstance
Gets the type of the service with the specific name.- Type Parameters:
T-- Parameters:
tClass- the typenamed- the name as represented by the javax.injext.Named annotation- Returns:
- the object representing the requested type.
-
getInstance
Gets the type of the service with the specific name.- Type Parameters:
T- the type- Parameters:
serviceKey- theElementServiceKey- Returns:
- the object representing the requested type.
-
findInstance
-
findInstance
-
findInstance
Gets the service using theElementServiceKey.
-