Abstract some duplicate code
parent
d5fc5e279d
commit
75c9142385
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.omertron.themoviedbapi.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stuart.Boston
|
||||
*/
|
||||
public class AbstractIdName extends AbstractJsonMapping {
|
||||
|
||||
private static final long serialVersionUID = 2L;
|
||||
|
||||
/*
|
||||
* Properties
|
||||
*/
|
||||
@JsonProperty("id")
|
||||
private int id;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final AbstractIdName other = (AbstractIdName) obj;
|
||||
if (this.id != other.id) {
|
||||
return false;
|
||||
}
|
||||
return !(this.name == null ? other.name != null : !this.name.equals(other.name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 37 * hash + this.id;
|
||||
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue