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

io.quarkus.resteasy.reactive.common.deployment.FactoryUtils Maven / Gradle / Ivy

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

import java.util.Objects;
import java.util.Set;

import org.jboss.jandex.ClassInfo;
import org.jboss.resteasy.reactive.common.core.SingletonBeanFactory;
import org.jboss.resteasy.reactive.spi.BeanFactory;

import io.quarkus.arc.deployment.BeanContainerBuildItem;
import io.quarkus.resteasy.reactive.common.runtime.ResteasyReactiveCommonRecorder;

public class FactoryUtils {
    public static  BeanFactory factory(ClassInfo providerClass, Set singletons,
            ResteasyReactiveCommonRecorder recorder,
            BeanContainerBuildItem beanContainerBuildItem) {
        return factory(providerClass.name().toString(), singletons, recorder, beanContainerBuildItem);
    }

    public static  BeanFactory factory(String providerClass, Set singletons,
            ResteasyReactiveCommonRecorder recorder,
            BeanContainerBuildItem beanContainerBuildItem) {
        Objects.requireNonNull(providerClass, "providerClass cannot be null");
        if (singletons.contains(providerClass)) {
            return new SingletonBeanFactory<>(providerClass);
        } else {
            return recorder.factory(providerClass,
                    beanContainerBuildItem.getValue());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy