Sonar fixes 2

This commit is contained in:
Stuart Boston
2015-03-04 09:13:55 +00:00
parent 0e57603b02
commit 1f1054995d
3 changed files with 49 additions and 25 deletions
@@ -22,12 +22,12 @@ package com.omertron.themoviedbapi.methods;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model2.movie.MovieDb;
import com.omertron.themoviedbapi.model2.collection.Collection;
import com.omertron.themoviedbapi.model2.company.Company;
import com.omertron.themoviedbapi.model2.keyword.Keyword;
import com.omertron.themoviedbapi.model2.list.UserList;
import com.omertron.themoviedbapi.model2.movie.MovieBasic;
import com.omertron.themoviedbapi.model2.movie.MovieDb;
import com.omertron.themoviedbapi.model2.person.Person;
import com.omertron.themoviedbapi.model2.person.PersonFind;
import com.omertron.themoviedbapi.model2.review.Review;
@@ -39,8 +39,6 @@ import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yamj.api.common.exception.ApiExceptionType;
/**
@@ -56,9 +54,6 @@ public class AbstractMethod {
protected final HttpTools httpTools;
// Jackson JSON configuration
protected static final ObjectMapper MAPPER = new ObjectMapper();
// Logger
protected static final Logger LOG = LoggerFactory.getLogger(AbstractMethod.class);
private static final Map<Class, TypeReference> TYPE_REFS = new HashMap<Class, TypeReference>();
static {
@@ -120,7 +115,7 @@ public class AbstractMethod {
* @return
* @throws MovieDbException
*/
public <T> List<T> processWrapperList(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
protected <T> List<T> processWrapperList(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
WrapperGenericList<T> val = processWrapper(typeRef, url, errorMessageSuffix);
return val.getResults();
}
@@ -135,7 +130,7 @@ public class AbstractMethod {
* @return
* @throws MovieDbException
*/
public <T> WrapperGenericList<T> processWrapper(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
protected <T> WrapperGenericList<T> processWrapper(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
String webpage = httpTools.getRequest(url);
try {
// Due to type erasure, this doesn't work
@@ -20,6 +20,7 @@
package com.omertron.themoviedbapi.model2.media;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
/**
@@ -34,8 +35,7 @@ public class MediaState extends AbstractJsonMapping {
private boolean favorite;
@JsonProperty("watchlist")
private boolean watchlist;
@JsonProperty("rated")
private RatedValue rated;
private float rated;
public int getId() {
return id;
@@ -62,24 +62,12 @@ public class MediaState extends AbstractJsonMapping {
}
public float getRated() {
return rated.getValue();
return rated;
}
@JsonSetter("rated")
public void setRated(RatedValue rated) {
this.rated = rated;
this.rated = rated.getValue();
}
public class RatedValue extends AbstractJsonMapping {
@JsonProperty("value")
private float value = -1f;
public float getValue() {
return value;
}
public void setValue(float value) {
this.value = value;
}
}
}
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2004-2015 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model2.media;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
/**
*
* @author Stuart.Boston
*/
public class RatedValue extends AbstractJsonMapping {
@JsonProperty("value")
private float value = -1f;
public float getValue() {
return value;
}
public void setValue(float value) {
this.value = value;
}
}