Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Commit

Permalink
Updated JavaDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyuri Grell committed Jan 9, 2017
1 parent a3f83a1 commit cf240ae
Showing 1 changed file with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,9 @@
import java.lang.reflect.Type;

/**
* The converter factory used for Jackson JSON conversion
*/
public class JacksonConverterFactory extends Converter.Factory {
/**
* Create an instance using a default {@link ObjectMapper} instance for conversion.
*/
public static JacksonConverterFactory create() {
return create(new ObjectMapper());
}

/**
* Create an instance using {@code mapper} for conversion.
*/
public static JacksonConverterFactory create(ObjectMapper mapper) {
return new JacksonConverterFactory(mapper);
}

private static String[] CAMPAIGN_CREATE_UPDATE_FIELDS = {
"name",
"subject",
Expand All @@ -46,9 +33,33 @@ public static JacksonConverterFactory create(ObjectMapper mapper) {
"message_footer"
};

/**
* Create an instance using a default {@link ObjectMapper} instance for conversion.
*
* @return A new instance of the converter factory with default {@link ObjectMapper}
*/
public static JacksonConverterFactory create() {
return create(new ObjectMapper());
}

/**
* Create an instance using {@code mapper} for conversion.
*
* @param mapper the mapper that will be used by the factory when creating converters
* @return a new instance of the converter facotyr
*/
public static JacksonConverterFactory create(ObjectMapper mapper) {
return new JacksonConverterFactory(mapper);
}

private final ObjectMapper mapper;
private final SimpleFilterProvider writerFilterProvider;

/**
* Creates a new instance.
*
* @param mapper the object mapper used when creating converter instances.
*/
private JacksonConverterFactory(ObjectMapper mapper) {
if (mapper == null) {
throw new NullPointerException("mapper == null");
Expand All @@ -59,6 +70,9 @@ private JacksonConverterFactory(ObjectMapper mapper) {
this.writerFilterProvider = new SimpleFilterProvider().addFilter("CampaignCreateUpdateFilter", campaignCreateUpdateFilter);
}

/**
* {@inheritDoc}
*/
@Override
public Converter<ResponseBody, ?> responseBodyConverter(Type type,
Annotation[] annotations,
Expand All @@ -68,6 +82,9 @@ private JacksonConverterFactory(ObjectMapper mapper) {
return new JacksonResponseBodyConverter<>(reader);
}

/**
* {@inheritDoc}
*/
@Override
public Converter<?, RequestBody> requestBodyConverter(Type type,
Annotation[] parameterAnnotations,
Expand Down

0 comments on commit cf240ae

Please sign in to comment.