Code tidy up
This commit is contained in:
@@ -67,7 +67,7 @@ public class AbstractMethod {
|
||||
protected final HttpTools httpTools;
|
||||
// Jackson JSON configuration
|
||||
protected static final ObjectMapper MAPPER = new ObjectMapper();
|
||||
private static final Map<Class, TypeReference> TYPE_REFS = new HashMap<Class, TypeReference>();
|
||||
private static final Map<Class, TypeReference> TYPE_REFS = new HashMap<>();
|
||||
|
||||
static {
|
||||
TYPE_REFS.put(MovieBasic.class, new TypeReference<WrapperGenericList<MovieBasic>>() {
|
||||
@@ -186,7 +186,7 @@ public class AbstractMethod {
|
||||
|
||||
try {
|
||||
WrapperChanges wrapper = MAPPER.readValue(webpage, WrapperChanges.class);
|
||||
ResultList<ChangeKeyItem> results = new ResultList<ChangeKeyItem>(wrapper.getChangedItems());
|
||||
ResultList<ChangeKeyItem> results = new ResultList<>(wrapper.getChangedItems());
|
||||
wrapper.setResultProperties(results);
|
||||
return results;
|
||||
} catch (IOException ex) {
|
||||
|
||||
@@ -21,14 +21,13 @@ package com.omertron.themoviedbapi.model.list;
|
||||
|
||||
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Holger Brandl
|
||||
*/
|
||||
public class ListItemStatus extends AbstractJsonMapping implements Serializable {
|
||||
public class ListItemStatus extends AbstractJsonMapping {
|
||||
|
||||
private static final long serialVersionUID = 100L;
|
||||
private static final long serialVersionUID = 101L;
|
||||
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
@@ -24,16 +24,15 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author stuart.boston
|
||||
* @param <T>
|
||||
*/
|
||||
public class PersonCreditList<T extends CreditBasic> extends AbstractJsonMapping implements Serializable, Identification {
|
||||
public class PersonCreditList<T extends CreditBasic> extends AbstractJsonMapping implements Identification {
|
||||
|
||||
private static final long serialVersionUID = 100L;
|
||||
private static final long serialVersionUID = 101L;
|
||||
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
|
||||
@@ -69,9 +69,9 @@ public class PersonInfo extends PersonBasic implements Serializable, AppendToRes
|
||||
// TODO: Add COMBINED_CREDITS
|
||||
private ExternalID externalIDs = new ExternalID();
|
||||
private List<Artwork> images = Collections.emptyList();
|
||||
private PersonCreditList<CreditMovieBasic> movieCredits = new PersonCreditList<CreditMovieBasic>();
|
||||
private List<ArtworkMedia> taggedImages = Collections.emptyList();
|
||||
private PersonCreditList<CreditTVBasic> tvCredits = new PersonCreditList<CreditTVBasic>();
|
||||
private PersonCreditList<CreditMovieBasic> movieCredits = new PersonCreditList<>();
|
||||
private PersonCreditList<CreditTVBasic> tvCredits = new PersonCreditList<>();
|
||||
|
||||
//<editor-fold defaultstate="collapsed" desc="Getters and Setters">
|
||||
public boolean isAdult() {
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
*/
|
||||
public class TmdbParameters {
|
||||
|
||||
private final Map<Param, String> parameters = new EnumMap<Param, String>(Param.class);
|
||||
private final Map<Param, String> parameters = new EnumMap<>(Param.class);
|
||||
|
||||
/**
|
||||
* Construct an empty set of parameters
|
||||
@@ -51,7 +51,7 @@ public class TmdbParameters {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a parameter to the collection
|
||||
* Add an array parameter to the collection
|
||||
*
|
||||
* @param key Parameter to add
|
||||
* @param value The array value to use (will be converted into a comma separated list)
|
||||
@@ -165,17 +165,16 @@ public class TmdbParameters {
|
||||
*/
|
||||
public String toList(final String[] appendToResponse) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (appendToResponse.length > 0) {
|
||||
boolean first = Boolean.TRUE;
|
||||
for (String append : appendToResponse) {
|
||||
if (first) {
|
||||
first = Boolean.FALSE;
|
||||
} else {
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append(append);
|
||||
boolean first = Boolean.TRUE;
|
||||
for (String append : appendToResponse) {
|
||||
if (first) {
|
||||
first = Boolean.FALSE;
|
||||
} else {
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append(append);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -183,6 +183,14 @@ public class TestSuite {
|
||||
assertTrue(message + " ID " + id + " not found in list", found);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the AppendToResponse method
|
||||
*
|
||||
* @param <T>
|
||||
* @param test
|
||||
* @param methodClass
|
||||
* @param skip Any methods to skip
|
||||
*/
|
||||
public static <T extends AppendToResponseMethod> void testATR(AppendToResponse<T> test, Class<T> methodClass, T skip) {
|
||||
for (T method : methodClass.getEnumConstants()) {
|
||||
if (skip != null && method != skip) {
|
||||
|
||||
Reference in New Issue
Block a user