Interface ComponentRegistry

    • Method Detail

      • isRegistered

        boolean isRegistered​(String alias)
        Checks whether the specified components class or alias is already registered.
        Parameters:
        alias - the fully qualified class name or an alias of the component.
        Returns:
        true if a provider exist, {code false} otherwise.
      • findLatestDescriptorByAlias

        <T> Optional<ComponentDescriptor<T>> findLatestDescriptorByAlias​(String alias)
        Finds a ComponentDescriptor for the specified class or alias. If more than one component is registered for the given alias, the latest version is returned.
        Type Parameters:
        T - the component type.
        Parameters:
        alias - the fully qualified class name or an alias of the component.
        Returns:
        the optional ComponentDescriptor instance.
      • findAllDescriptorsByType

        <T> Collection<ComponentDescriptor<T>> findAllDescriptorsByType​(Class<T> type)
        Finds all registered providers for the specified type.
        Type Parameters:
        T - the component type.
        Parameters:
        type - the component class.
        Returns:
        the collection of ComponentDescriptor.
      • getComponent

        <T> T getComponent​(Class<T> type,
                           Conf conf)
        Gets an instance, which may be shared or independent, for the specified type.
        Type Parameters:
        T - the component-type.
        Parameters:
        type - the component class.
        conf - the configuration used if the component implement Configurable.
        Returns:
        the instance of type ComponentRegistry.
        Throws:
        NoUniqueComponentException - if more than one component is registered for the given type.
        NoSuchComponentException - if no component is registered for the given type.
      • getLatestComponent

        <T> T getLatestComponent​(Class<T> type,
                                 Conf conf)
        Gets an instance, which may be shared or independent, for the specified type. If more than one component is registered for the given type, the latest version is returned.
        Type Parameters:
        T - the component-type.
        Parameters:
        type - the component class.
        conf - the configuration used if the component implement Configurable.
        Returns:
        the instance of type ComponentRegistry.
        Throws:
        NoSuchComponentException - if no component is registered for the given type.
      • getComponent

        <T> T getComponent​(String alias,
                           Conf conf)
        Gets an instance, which may be shared or independent, for the specified type.
        Type Parameters:
        T - the component-type.
        Parameters:
        alias - the fully qualified class name or an alias of the component.
        conf - the configuration used if the component implement Configurable.
        Returns:
        the instance of type ComponentRegistry.
        Throws:
        NoUniqueComponentException - if more than one component is registered for the given type.
        NoSuchComponentException - if no component is registered for the given class or alias..
      • getLatestComponent

        <T> T getLatestComponent​(String alias,
                                 Conf conf)
        Gets an instance, which may be shared or independent, for the specified type. If more than one component is registered for the given type, the latest version is returned.
        Type Parameters:
        T - the component-type.
        Parameters:
        alias - the fully qualified class name or an alias of the component.
        conf - the configuration used if the component implement Configurable.
        Returns:
        the instance of type ComponentRegistry.
        Throws:
        NoSuchComponentException - if no component is registered for the given type.
      • getVersionedComponent

        <T> T getVersionedComponent​(String alias,
                                    String version,
                                    Conf conf)
        Gets an instance, which may be shared or independent, for the specified type. If more than one component is registered for the given type, the latest version is returned.
        Type Parameters:
        T - the component-type.
        Parameters:
        alias - the fully qualified class name or an alias of the component.
        conf - the configuration used if the component implement Configurable.
        Returns:
        the instance of type ComponentRegistry.
        Throws:
        NoSuchComponentException - if no component is registered for the given type.
      • getAllComponents

        <T> Collection<T> getAllComponents​(String alias,
                                           Conf conf)
        Gets all instances, which may be shared or independent, for the specified type.
        Type Parameters:
        T - the component-type.
        Parameters:
        alias - the fully qualified class name or an alias of the component.
        conf - the configuration used if the component implement Configurable.
        Returns:
        the instance of type ComponentRegistry.
        Throws:
        NoUniqueComponentException - if more than one component is registered for the given type.
        NoSuchComponentException - if no component is registered for the given class or alias..
      • getAllComponents

        <T> Collection<T> getAllComponents​(Class<T> type,
                                           Conf conf)
        Gets all instances, which may be shared or independent, for the specified type.
        Type Parameters:
        T - the component-type.
        Parameters:
        type - the component class.
        conf - the configuration used if the component implement Configurable.
        Returns:
        the instance of type ComponentRegistry.