|
29 | 29 | import java.util.Set;
|
30 | 30 | import java.util.function.Function;
|
31 | 31 |
|
| 32 | +import com.fasterxml.jackson.core.type.TypeReference; |
32 | 33 | import com.fasterxml.jackson.databind.Module;
|
33 | 34 | import com.fasterxml.jackson.databind.ObjectMapper;
|
34 | 35 |
|
@@ -254,9 +255,13 @@ public OAuth2Authorization findByToken(String token, @Nullable OAuth2TokenType t
|
254 | 255 | return null;
|
255 | 256 | }
|
256 | 257 |
|
257 |
| - private OAuth2Authorization findBy(String filter, List<SqlParameterValue> parameters) { |
| 258 | + protected final List<OAuth2Authorization> findAll(String filter, List<SqlParameterValue> parameters) { |
258 | 259 | PreparedStatementSetter pss = new ArgumentPreparedStatementSetter(parameters.toArray());
|
259 |
| - List<OAuth2Authorization> result = this.jdbcOperations.query(LOAD_AUTHORIZATION_SQL + filter, pss, this.authorizationRowMapper); |
| 260 | + return this.jdbcOperations.query(LOAD_AUTHORIZATION_SQL + filter, pss, this.authorizationRowMapper); |
| 261 | + } |
| 262 | + |
| 263 | + protected final OAuth2Authorization findBy(String filter, List<SqlParameterValue> parameters) { |
| 264 | + List<OAuth2Authorization> result = findAll(filter, parameters); |
260 | 265 | return !result.isEmpty() ? result.get(0) : null;
|
261 | 266 | }
|
262 | 267 |
|
@@ -436,10 +441,9 @@ protected final ObjectMapper getObjectMapper() {
|
436 | 441 | return this.objectMapper;
|
437 | 442 | }
|
438 | 443 |
|
439 |
| - @SuppressWarnings("unchecked") |
440 | 444 | private Map<String, Object> parseMap(String data) {
|
441 | 445 | try {
|
442 |
| - return this.objectMapper.readValue(data, Map.class); |
| 446 | + return this.objectMapper.readValue(data, new TypeReference<Map<String, Object>>() {}); |
443 | 447 | } catch (Exception ex) {
|
444 | 448 | throw new IllegalArgumentException(ex.getMessage(), ex);
|
445 | 449 | }
|
@@ -542,7 +546,6 @@ private <T extends AbstractOAuth2Token> List<SqlParameterValue> toSqlParameterLi
|
542 | 546 | return parameters;
|
543 | 547 | }
|
544 | 548 |
|
545 |
| - @SuppressWarnings("unchecked") |
546 | 549 | private String writeMap(Map<String, Object> data) {
|
547 | 550 | try {
|
548 | 551 | return this.objectMapper.writeValueAsString(data);
|
|
0 commit comments