All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.amayaframework.di.ServiceProvider Maven / Gradle / Ivy

Go to download

A framework responsible for monitoring and automating the dependency injection process.

There is a newer version: 2.2.0
Show newest version
package io.github.amayaframework.di;

import com.github.romanqed.jfunc.Function0;

/**
 * An interface describing an abstract provider that instantiates the requested service by specified type.
 */
public interface ServiceProvider {

    /**
     * Searches for an instantiator for the specified artifact.
     *
     * @param artifact the specified artifact
     * @param       service type
     * @return null or empty stub, if artifact not found, instantiator implementation otherwise
     */
     Function0 get(Artifact artifact);

    /**
     * Searches for an instantiator for the specified class and its generics.
     *
     * @param type     the specified class
     * @param generics the specified generics
     * @param       service type
     * @return null or empty stub, if parameterized class not found, instantiator implementation otherwise
     */
     Function0 get(Class type, Class... generics);

    /**
     * Searches for an instantiator for the specified class.
     *
     * @param type the specified class
     * @param   service type
     * @return null or empty stub, if class not found, instantiator implementation otherwise
     */
     Function0 get(Class type);

    /**
     * Instantiates the service requested by specified artifact.
     *
     * @param artifact the specified artifact
     * @param       service type
     * @return null, if artifact not found, service instance otherwise
     */
     T instantiate(Artifact artifact);

    /**
     * Instantiates the service requested by the specified class and its generics.
     *
     * @param type     the specified class
     * @param generics the specified generics
     * @param       service type
     * @return null, if parameterized class not found, service instance otherwise
     */
     T instantiate(Class type, Class... generics);

    /**
     * Instantiates the service requested by the specified class.
     *
     * @param type the specified class
     * @param   service type
     * @return null, if class not found, service instance otherwise
     */
     T instantiate(Class type);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy