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

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

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

import java.util.function.Supplier;

import jakarta.ws.rs.Priorities;
import jakarta.ws.rs.ext.ExceptionMapper;

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

public class ResourceExceptionMapper implements Comparable> {

    private BeanFactory> factory;
    private int priority = Priorities.USER;
    private String className;

    private Supplier discardAtRuntime;

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

    public BeanFactory> getFactory() {
        return factory;
    }

    public int getPriority() {
        return priority;
    }

    public void setPriority(int priority) {
        this.priority = priority;
    }

    public String getClassName() {
        return className;
    }

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

    public Supplier getDiscardAtRuntime() {
        return discardAtRuntime;
    }

    public void setDiscardAtRuntime(Supplier discardAtRuntime) {
        this.discardAtRuntime = discardAtRuntime;
    }

    @Override
    public int compareTo(ResourceExceptionMapper o) {
        return Integer.compare(this.priority, o.priority);
    }

    public static final class DiscardAtRuntimeIfBeanIsUnavailable implements Supplier {
        private final String beanClass;

        public DiscardAtRuntimeIfBeanIsUnavailable(String beanClass) {
            this.beanClass = beanClass;
        }

        @Override
        public Boolean get() {
            throw new IllegalStateException("should never be called");
        }

        public String getBeanClass() {
            return beanClass;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy