Package com.vaadin.flow.di
Class LookupInitializer.LookupImpl
- java.lang.Object
-
- com.vaadin.flow.di.LookupInitializer.LookupImpl
-
- All Implemented Interfaces:
Lookup
- Enclosing class:
- LookupInitializer
protected static class LookupInitializer.LookupImpl extends Object implements Lookup
Default implementation ofLookup
.- Since:
- Author:
- Vaadin Ltd
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Class<?>,Collection<Object>>
serviceMap
-
Constructor Summary
Constructors Modifier Constructor Description protected
LookupImpl(Map<Class<?>,Collection<Class<?>>> initialServices, BiFunction<Class<?>,Class<?>,Object> factory)
Creates a new instance ofLookup
with services found in the application classpath.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
lookup(Class<T> serviceClass)
Lookup for a service of the given type.<T> Collection<T>
lookupAll(Class<T> serviceClass)
Lookup for all services by the providedserviceClass
.
-
-
-
Field Detail
-
serviceMap
protected final Map<Class<?>,Collection<Object>> serviceMap
-
-
Constructor Detail
-
LookupImpl
protected LookupImpl(Map<Class<?>,Collection<Class<?>>> initialServices, BiFunction<Class<?>,Class<?>,Object> factory)
Creates a new instance ofLookup
with services found in the application classpath.- Parameters:
initialServices
- map of initial services with their implementationsfactory
- a factory to create a service object instance
-
-
Method Detail
-
lookup
public <T> T lookup(Class<T> serviceClass)
Description copied from interface:Lookup
Lookup for a service of the given type.The
serviceClass
is usually an interface (though it doesn't have to be) and the returned value is some implementation of this interface.- Specified by:
lookup
in interfaceLookup
- Type Parameters:
T
- a service type- Parameters:
serviceClass
- a service SPI class- Returns:
- a service which implements the
serviceClass
, may benull
if no services are registered for this SPI - See Also:
Lookup.lookupAll(Class)
-
lookupAll
public <T> Collection<T> lookupAll(Class<T> serviceClass)
Description copied from interface:Lookup
Lookup for all services by the providedserviceClass
.The
serviceClass
is usually an interface class (though it doesn't have to be) and the returned value is all implementations of this interface.
-
-