1 package org.springframework.security.oauth2.common;
2
3 import java.io.Serializable;
4
5 import com.fasterxml.jackson.annotation.JsonCreator;
6 import com.fasterxml.jackson.annotation.JsonValue;
7
8
9
10
11
12
13
14 public class DefaultOAuth2RefreshToken implements Serializable, OAuth2RefreshToken {
15
16 private static final long serialVersionUID = 8349970621900575838L;
17
18 private String value;
19
20
21
22
23 @JsonCreator
24 public DefaultOAuth2RefreshToken(String value) {
25 this.value = value;
26 }
27
28
29
30
31 @SuppressWarnings("unused")
32 private DefaultOAuth2RefreshToken() {
33 this(null);
34 }
35
36
37
38
39 @JsonValue
40 public String getValue() {
41 return value;
42 }
43
44 @Override
45 public String toString() {
46 return getValue();
47 }
48
49 @Override
50 public boolean equals(Object o) {
51 if (this == o) {
52 return true;
53 }
54 if (!(o instanceof DefaultOAuth2RefreshToken)) {
55 return false;
56 }
57
58 DefaultOAuth2RefreshToken that = (DefaultOAuth2RefreshToken) o;
59
60 if (value != null ? !value.equals(that.value) : that.value != null) {
61 return false;
62 }
63
64 return true;
65 }
66
67 @Override
68 public int hashCode() {
69 return value != null ? value.hashCode() : 0;
70 }
71 }