br.com.jhonsapp.bootstrap.user.model.token.android.AndroidToken Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bootstrap-user Show documentation
Show all versions of bootstrap-user Show documentation
A complete architecture for creating and managing users.
package br.com.jhonsapp.bootstrap.user.model.token.android;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name = "android_token")
@SequenceGenerator(name = "android_token_seq_generator", sequenceName = "android_token_seq", allocationSize = 1, initialValue = 1)
public class AndroidToken implements FirebaseToken {
/**
* Generated serial version id created at 16 August 2017.
*/
private static final long serialVersionUID = -6232755587272286008L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "android_token_seq_generator")
private long id;
@Column(name = "token")
private String token;
public AndroidToken() { }
public long getId() {
return id;
}
@Override
public String getToken() {
return token;
}
@Override
public void setToken(String token) {
this.token = token;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((token == null) ? 0 : token.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AndroidToken other = (AndroidToken) obj;
if (id != other.id)
return false;
if (token == null) {
if (other.token != null)
return false;
} else if (!token.equals(other.token))
return false;
return true;
}
}