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

nl.vpro.rs.converters.CaseInsensitiveEnumParamConverterProvider Maven / Gradle / Ivy

package nl.vpro.rs.converters;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

import jakarta.ws.rs.ext.ParamConverter;
import jakarta.ws.rs.ext.ParamConverterProvider;
import jakarta.ws.rs.ext.Provider;

/**
 * @author Michiel Meeuwissen
 * @since 1.75
 */
@Provider
public class CaseInsensitiveEnumParamConverterProvider implements ParamConverterProvider {

    @SuppressWarnings({"unchecked", "rawtypes"})
    @Override
    public  ParamConverter getConverter(Class rawType, Type genericType, Annotation[] annotations) {
        if (Enum.class.isAssignableFrom(rawType)) {
            Class clazz = (Class>) rawType;
            return CaseInsensitiveEnumParamConverter.getInstant(clazz);
        } else {
            return null;
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy