package api.v1; import com.fasterxml.jackson.annotation.JsonInclude; import java.util.List; @JsonInclude(JsonInclude.Include.NON_NULL) public class Token { public String access_token; public String token_type; public Long expires_in; public String refresh_token; //public List<String> scope; public Token(String accessToken, String tokenType, Long expiresIn, String refreshToken, List<String> scope) { this.access_token = accessToken; this.token_type = tokenType; this.expires_in = expiresIn; this.refresh_token = refreshToken; //this.scope = scope; } public Token() { } public enum TokenType { BEARER("Bearer"); private final String value; TokenType(String value) { this.value = value; } public String getValue() { return value; } } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Token token = (Token) o; if (access_token != null ? !access_token.equals(token.access_token) : token.access_token != null) { return false; } if (expires_in != null ? !expires_in.equals(token.expires_in) : token.expires_in != null) { return false; } if (refresh_token != null ? !refresh_token.equals(token.refresh_token) : token.refresh_token != null) { return false; } //if (scope != null ? !scope.equals(token.scope) : token.scope != null) { return false; } if (token_type != null ? !token_type.equals(token.token_type) : token.token_type != null) { return false; } return true; } @Override public int hashCode() { int result = access_token != null ? access_token.hashCode() : 0; result = 31 * result + (token_type != null ? token_type.hashCode() : 0); result = 31 * result + (expires_in != null ? expires_in.hashCode() : 0); result = 31 * result + (refresh_token != null ? refresh_token.hashCode() : 0); //result = 31 * result + (scope != null ? scope.hashCode() : 0); return result; } }