Update person models

This commit is contained in:
Stuart Boston
2018-04-03 19:45:03 +01:00
parent 240110848a
commit 119a51c8e8
2 changed files with 18 additions and 11 deletions
@@ -20,6 +20,8 @@
package com.omertron.themoviedbapi.model.person;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.omertron.themoviedbapi.enumeration.Gender;
import com.omertron.themoviedbapi.model.AbstractIdName;
import java.io.Serializable;
@@ -32,6 +34,8 @@ public class PersonBasic extends AbstractIdName implements Serializable {
@JsonProperty("profile_path")
private String profilePath;
@JsonProperty("gender")
private Gender gender;
public String getProfilePath() {
return profilePath;
@@ -40,4 +44,18 @@ public class PersonBasic extends AbstractIdName implements Serializable {
public void setProfilePath(String profilePath) {
this.profilePath = profilePath;
}
public Gender getGender() {
return gender;
}
@JsonSetter("gender")
public void setGender(int gender) {
this.gender = Gender.fromInteger(gender);
}
public void setGender(Gender gender) {
this.gender = gender;
}
}
@@ -21,7 +21,6 @@ package com.omertron.themoviedbapi.model.person;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.omertron.themoviedbapi.enumeration.Gender;
import com.omertron.themoviedbapi.enumeration.PeopleMethod;
import com.omertron.themoviedbapi.interfaces.AppendToResponse;
import com.omertron.themoviedbapi.model.artwork.Artwork;
@@ -63,7 +62,6 @@ public class PersonInfo extends PersonBasic implements Serializable, AppendToRes
private String placeOfBirth;
@JsonProperty("popularity")
private float popularity;
private Gender gender;
// AppendToResponse
private final Set<PeopleMethod> methods = EnumSet.noneOf(PeopleMethod.class);
// AppendToResponse Properties
@@ -152,15 +150,6 @@ public class PersonInfo extends PersonBasic implements Serializable, AppendToRes
methods.add(method);
}
public Gender getGender() {
return gender;
}
@JsonSetter("gender")
public void setGender(int gender) {
this.gender = Gender.fromInteger(gender);
}
@Override
public boolean hasMethod(PeopleMethod method) {
return methods.contains(method);