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

com.cerner.beadledom.client.jackson.JacksonJsonGuiceProvider Maven / Gradle / Ivy

The newest version!
package com.cerner.beadledom.client.jackson;

import com.cerner.beadledom.guice.BindingAnnotations;
import com.cerner.beadledom.guice.dynamicbindings.DynamicBindingProvider;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
import java.lang.annotation.Annotation;
import javax.inject.Inject;
import javax.inject.Provider;

/**
 * A Guice provider for {@link JacksonJsonProvider}.
 *
 * @author John Leacox
 * @author Sundeep Paruvu
 * @author Nimesh Subramanian
 * @since 1.0
 * @deprecated As of 3.6, use Retrofit (https://github.com/square/retrofit) instead.
 */
@Deprecated
class JacksonJsonGuiceProvider implements Provider {
  private ObjectMapper objectMapper;
  private final Class clientBindingAnnotation;

  JacksonJsonGuiceProvider(Class clientBindingAnnotation) {
    if (clientBindingAnnotation == null) {
      throw new NullPointerException("clientBindingAnnotation:null");
    }

    BindingAnnotations.checkIsBindingAnnotation(clientBindingAnnotation);
    this.clientBindingAnnotation = clientBindingAnnotation;
  }

  @Inject
  void init(DynamicBindingProvider objectMapperProvider) {
    this.objectMapper = objectMapperProvider.get(clientBindingAnnotation);
  }

  @Override
  public JacksonJsonProvider get() {
    return new JacksonJsonProvider(objectMapper);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy