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

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

package nl.vpro.rs.converters;

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

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

/**
 * @author Michiel Meeuwissen
 * @since 0.28
 */
@Provider
public class DurationParamConverterProvider implements ParamConverterProvider {
    @SuppressWarnings("unchecked")
    @Override
    public  ParamConverter getConverter(Class rawType, Type genericType, Annotation[] annotations) {
        if (Duration.class.isAssignableFrom(rawType)) {
            return (ParamConverter) DurationParamConverter.INSTANCE;
        }

        return null;

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy