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

io.quarkus.resteasy.reactive.common.runtime.ArcBeanFactory Maven / Gradle / Ivy

There is a newer version: 3.15.2
Show newest version
package io.quarkus.resteasy.reactive.common.runtime;

import org.jboss.resteasy.reactive.spi.BeanFactory;

import io.quarkus.arc.runtime.BeanContainer;

public class ArcBeanFactory implements BeanFactory {

    private final BeanContainer.Factory factory;
    // for toString
    private final String targetClassName;

    public ArcBeanFactory(Class target, BeanContainer beanContainer) {
        targetClassName = target.getName();
        factory = beanContainer.instanceFactory(target);
    }

    @Override
    public String toString() {
        return "ArcBeanFactory[" + targetClassName + "]";
    }

    @Override
    public BeanInstance createInstance() {
        BeanContainer.Instance instance = factory.create();
        return new BeanInstance() {
            @Override
            public T getInstance() {
                return instance.get();
            }

            @Override
            public void close() {
                instance.close();
            }
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy