
com.github.tinosteinort.beanrepository.InstanceProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of beanrepository Show documentation
Show all versions of beanrepository Show documentation
BeanRepository - Dependency Injection / Service Locator Mix. Without Reflection and Annotations.
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