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

org.jboss.resteasy.reactive.common.model.ResourceContextResolver Maven / Gradle / Ivy

There is a newer version: 3.17.0.CR1
Show newest version
package org.jboss.resteasy.reactive.common.model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.ext.ContextResolver;

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

public class ResourceContextResolver {

    private BeanFactory> factory;
    private String className;
    private List mediaTypeStrings = new ArrayList<>();
    private volatile List mediaTypes;

    public void setFactory(BeanFactory> factory) {
        this.factory = factory;
    }

    public BeanFactory> getFactory() {
        return factory;
    }

    public String getClassName() {
        return className;
    }

    public ResourceContextResolver setClassName(String className) {
        this.className = className;
        return this;
    }

    public ResourceContextResolver setMediaTypeStrings(List mediaTypeStrings) {
        this.mediaTypeStrings = mediaTypeStrings;
        return this;
    }

    public List getMediaTypeStrings() {
        return mediaTypeStrings;
    }

    public List mediaTypes() {
        if (mediaTypes == null) {
            //todo: does this actually need to be threadsafe?
            synchronized (this) {
                List ret = new ArrayList<>();
                for (String i : mediaTypeStrings) {
                    ret.add(MediaType.valueOf(i));
                }
                mediaTypes = Collections.unmodifiableList(ret);
            }
        }
        return mediaTypes;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy