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

com.nhl.link.rest.runtime.provider.CayenneExpProvider Maven / Gradle / Ivy

package com.nhl.link.rest.runtime.provider;

import com.nhl.link.rest.protocol.CayenneExp;
import com.nhl.link.rest.runtime.protocol.ICayenneExpParser;
import com.nhl.link.rest.runtime.provider.converter.CayenneExpConverter;
import org.apache.cayenne.di.Inject;

import javax.ws.rs.ext.ParamConverter;
import javax.ws.rs.ext.ParamConverterProvider;
import javax.ws.rs.ext.Provider;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

/**
 * @since 2.13
 */
@Provider
public class CayenneExpProvider implements ParamConverterProvider {

    private final CayenneExpConverter cayenneExpConverter;


    public CayenneExpProvider(@Inject ICayenneExpParser cayenneExpParser) {
        this.cayenneExpConverter = new CayenneExpConverter(cayenneExpParser);
    }

    @Override
    public  ParamConverter getConverter(Class rawType, Type genericType, Annotation[] annotations) {

        return (rawType == CayenneExp.class) ? (ParamConverter)cayenneExpConverter : null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy