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

com.github.tinosteinort.beanrepository.InstanceProvider Maven / Gradle / Ivy

Go to download

BeanRepository - Dependency Injection / Service Locator Mix. Without Reflection and Annotations.

There is a newer version: 1.7.0
Show newest version
package com.github.tinosteinort.beanrepository;

class InstanceProvider implements BeanProvider {

    private final String repositoryId;
    private final Object instance;

    InstanceProvider(final String repositoryId, final Object instance) {
        this.repositoryId = repositoryId;
        if (instance == null) {
            throw new IllegalArgumentException("Instance must not be null");
        }
        this.instance = instance;
    }

    @Override public  T getBean(final BeanRepository repository, final boolean dryRun) {
        return (T) instance;
    }

    @Override public String getRepositoryId() {
        return repositoryId;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy