You're viewing an older version of Vaadin JavaDoc. Please see version 24.7.0 for the latest.
com.vaadin.flow.di.

Class LookupInitializer.LookupImpl

  • All Implemented Interfaces:

    Lookup

    Enclosing class:

    LookupInitializer

    protected static class LookupInitializer.LookupImpl
    extends Object
    implements Lookup

    Default implementation of Lookup.

    Since:

    Author:

    Vaadin Ltd

    • Constructor Detail

      • LookupImpl

        protected LookupImpl​(Map<Class<?>,​Collection<Class<?>>> initialServices,
                             BiFunction<Class<?>,​Class<?>,​Object> factory)

        Creates a new instance of Lookup with services found in the application classpath.

        Parameters:

        initialServices - map of initial services with their implementations

        factory - 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 interface Lookup

        Type Parameters:

        T - a service type

        Parameters:

        serviceClass - a service SPI class

        Returns:

        a service which implements the serviceClass, may be null 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 provided serviceClass.

        The serviceClass is usually an interface class (though it doesn't have to be) and the returned value is all implementations of this interface.

        Specified by:

        lookupAll in interface Lookup

        Type Parameters:

        T - a service type

        Parameters:

        serviceClass - a service SPI class

        Returns:

        all services which implement the serviceClass, if no services found an empty list is returned (so null is not returned)