[java-oidc-common] branch main updated: Add generic type to map entry value in the default JSON strategy

Phil Smart philip.smart at jisc.ac.uk
Wed Nov 3 10:59:22 UTC 2021


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch main
in repository java-oidc-common.

View the commit online:
http://git.shibboleth.net/view/?p=java-oidc-common.git;a=commit;h=e743b8e8e5b6e968c9acb96f2bfdda95ca73518a

The following commit(s) were added to refs/heads/main by this push:
     new e743b8e  Add generic type to map entry value in the default JSON strategy
e743b8e is described below

commit e743b8e8e5b6e968c9acb96f2bfdda95ca73518a
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Wed Nov 3 10:59:19 2021 +0000

    Add generic type to map entry value in the default JSON strategy
---
 .../cache/impl/DefaultJSONMapParsingStrategy.java         | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DefaultJSONMapParsingStrategy.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DefaultJSONMapParsingStrategy.java
index dffef6a..b9f91fd 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DefaultJSONMapParsingStrategy.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DefaultJSONMapParsingStrategy.java
@@ -34,8 +34,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
-/** Deserializes a UTF-8 JSON string into a Map.*/
-public class DefaultJSONMapParsingStrategy implements Function<byte[], List<Map<String, Object>>> {
+/** 
+ * Deserializes a UTF-8 JSON string into a Map.
+ * 
+ * @param <V> the map entry type.
+ */
+public class DefaultJSONMapParsingStrategy<V extends Object> 
+                        implements Function<byte[], List<Map<String, V>>> {
     
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(DefaultJSONMapParsingStrategy.class);
@@ -58,11 +63,11 @@ public class DefaultJSONMapParsingStrategy implements Function<byte[], List<Map<
     }
 
     @Override
-    public List<Map<String, Object>> apply(byte[] rawMetadata) {
+    public List<Map<String, V>> apply(byte[] rawMetadata) {
         try {
-            Map<String, Object> parsed = 
+            Map<String, V> parsed = 
                     objectMapper.readValue(new String(rawMetadata, StandardCharsets.UTF_8), 
-                            new TypeReference<Map<String,Object>>(){});
+                            new TypeReference<Map<String,V>>(){});
             if (parsed != null) {
                 return List.of(parsed);
             }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list