[java-identity-provider] 02/02: IDP-1121 Simplify typing for IdPAttributeValue

Rod Widdowson rdw at steadingsoftware.com
Wed Apr 24 11:55:40 EDT 2019


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

rdw pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=3be28a4be520b21bf0af3c16f5588ce36d79cd88

commit 3be28a4be520b21bf0af3c16f5588ce36d79cd88
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Apr 24 16:24:35 2019 +0100

    IDP-1121 Simplify typing for IdPAttributeValue
    
    https://issues.shibboleth.net/jira/browse/IDP-1121
    
    Remove some more <? extends IdPAttributeValue> usage in favor of
    <IdPAttributeValue<?>
---
 .../filter/context/AttributeFilterWorkContext.java | 24 +++++++++++-----------
 .../filter/AttributeValueFilterPolicyTest.java     |  2 +-
 .../context/AttributeFilterWorkContextTest.java    |  4 ++--
 .../impl/MappedAttributeInMetadataMatcher.java     |  2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/context/AttributeFilterWorkContext.java b/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/context/AttributeFilterWorkContext.java
index 88b2724..16ee7ec 100644
--- a/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/context/AttributeFilterWorkContext.java
+++ b/idp-attribute-filter-api/src/main/java/net/shibboleth/idp/attribute/filter/context/AttributeFilterWorkContext.java
@@ -51,15 +51,15 @@ import org.opensaml.messaging.context.BaseContext;
 public final class AttributeFilterWorkContext extends BaseContext {
 
     /** Values, for a given attribute, that are permitted to be released. */
-    private final Map<String, Set<IdPAttributeValue>> permittedValues;
+    private final Map<String, Set<IdPAttributeValue<?>>> permittedValues;
 
     /** Values, for a given attribute, that are not permitted to be released. */
-    private final Map<String, Set<IdPAttributeValue>> deniedValues;
+    private final Map<String, Set<IdPAttributeValue<?>>> deniedValues;
 
     /** Constructor. */
     public AttributeFilterWorkContext() {
-        permittedValues = new HashMap<String, Set<IdPAttributeValue>>();
-        deniedValues = new HashMap<String, Set<IdPAttributeValue>>();
+        permittedValues = new HashMap<String, Set<IdPAttributeValue<?>>>();
+        deniedValues = new HashMap<String, Set<IdPAttributeValue<?>>>();
     }
 
     /**
@@ -68,7 +68,7 @@ public final class AttributeFilterWorkContext extends BaseContext {
      * @return collection of attribute values, indexed by ID, that are permitted to be released,
      */
     @Nonnull @NonnullElements @Unmodifiable public
-            Map<String, Set<IdPAttributeValue>> getPermittedIdPAttributeValues() {
+            Map<String, Set<IdPAttributeValue<?>>> getPermittedIdPAttributeValues() {
         return Collections.unmodifiableMap(permittedValues);
     }
 
@@ -82,7 +82,7 @@ public final class AttributeFilterWorkContext extends BaseContext {
      * @param attributeValues values for the attribute that are permitted to be released
      */
     public void addPermittedIdPAttributeValues(@Nonnull @NotEmpty final String attributeId,
-            @Nullable @NullableElements final Collection<? extends IdPAttributeValue> attributeValues) {
+            @Nullable @NullableElements final Collection<IdPAttributeValue<?>> attributeValues) {
         final AttributeFilterContext parent = (AttributeFilterContext) getParent();
         final Map<String, IdPAttribute> prefilteredAttributes = parent.getPrefilteredIdPAttributes();
         final String trimmedAttributeId =
@@ -94,13 +94,13 @@ public final class AttributeFilterWorkContext extends BaseContext {
             return;
         }
 
-        Set<IdPAttributeValue> permittedAttributeValues = permittedValues.get(trimmedAttributeId);
+        Set<IdPAttributeValue<?>> permittedAttributeValues = permittedValues.get(trimmedAttributeId);
         if (permittedAttributeValues == null) {
             permittedAttributeValues = new HashSet<>();
             permittedValues.put(trimmedAttributeId, permittedAttributeValues);
         }
 
-        for (final IdPAttributeValue value : attributeValues) {
+        for (final IdPAttributeValue<?> value : attributeValues) {
             if (value != null) {
                 if (!prefilteredAttributes.get(trimmedAttributeId).getValues().contains(value)) {
                     throw new IllegalArgumentException("permitted value is not a current value of attribute "
@@ -119,7 +119,7 @@ public final class AttributeFilterWorkContext extends BaseContext {
      * 
      * @return collection of attribute values, indexed by ID, that are not permitted to be released
      */
-    @Nonnull @NonnullElements @Unmodifiable public Map<String, Set<IdPAttributeValue>> getDeniedAttributeValues() {
+    @Nonnull @NonnullElements @Unmodifiable public Map<String, Set<IdPAttributeValue<?>>> getDeniedAttributeValues() {
         return Collections.unmodifiableMap(deniedValues);
     }
 
@@ -133,7 +133,7 @@ public final class AttributeFilterWorkContext extends BaseContext {
      * @param attributeValues values for the attribute that are not permitted to be released
      */
     public void addDeniedIdPAttributeValues(@Nonnull @NotEmpty final String attributeId,
-            @Nullable @NullableElements final Collection<? extends IdPAttributeValue> attributeValues) {
+            @Nullable @NullableElements final Collection<IdPAttributeValue<?>> attributeValues) {
         final AttributeFilterContext parent = (AttributeFilterContext) getParent();
         final Map<String, IdPAttribute> prefilteredAttributes = parent.getPrefilteredIdPAttributes();
         final String trimmedAttributeId =
@@ -145,13 +145,13 @@ public final class AttributeFilterWorkContext extends BaseContext {
             return;
         }
 
-        Set<IdPAttributeValue> deniedAttributeValues = deniedValues.get(trimmedAttributeId);
+        Set<IdPAttributeValue<?>> deniedAttributeValues = deniedValues.get(trimmedAttributeId);
         if (deniedAttributeValues == null) {
             deniedAttributeValues = new HashSet<>();
             deniedValues.put(trimmedAttributeId, deniedAttributeValues);
         }
 
-        for (final IdPAttributeValue value : attributeValues) {
+        for (final IdPAttributeValue<?> value : attributeValues) {
             if (value != null) {
                 if (!prefilteredAttributes.get(trimmedAttributeId).getValues().contains(value)) {
                     throw new IllegalArgumentException("denied value is not a current value of attribute "
diff --git a/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/AttributeValueFilterPolicyTest.java b/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/AttributeValueFilterPolicyTest.java
index d7ed33f..d99c74d 100644
--- a/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/AttributeValueFilterPolicyTest.java
+++ b/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/AttributeValueFilterPolicyTest.java
@@ -235,7 +235,7 @@ public class AttributeValueFilterPolicyTest {
 
         policy.apply(attribute1, context);
 
-        Collection<IdPAttributeValue> result = workCtx.getPermittedIdPAttributeValues().get(ATTR_NAME);
+        Collection<IdPAttributeValue<?>> result = workCtx.getPermittedIdPAttributeValues().get(ATTR_NAME);
         Assert.assertEquals(result.size(), 2);
         Assert.assertTrue(result.contains(aStringAttributeValue));
         Assert.assertTrue(result.contains(cStringAttributeValue));
diff --git a/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/context/AttributeFilterWorkContextTest.java b/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/context/AttributeFilterWorkContextTest.java
index 25dc5a3..d0b4bcc 100644
--- a/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/context/AttributeFilterWorkContextTest.java
+++ b/idp-attribute-filter-api/src/test/java/net/shibboleth/idp/attribute/filter/context/AttributeFilterWorkContextTest.java
@@ -55,7 +55,7 @@ public class AttributeFilterWorkContextTest {
         context.addPermittedIdPAttributeValues("one", null);
         Assert.assertEquals(context.getPermittedIdPAttributeValues().get("one").size(), 1);
 
-        context.addPermittedIdPAttributeValues("one", new ArrayList<IdPAttributeValue>());
+        context.addPermittedIdPAttributeValues("one", new ArrayList<IdPAttributeValue<?>>());
         Assert.assertEquals(context.getPermittedIdPAttributeValues().get("one").size(), 1);
 
         context.addPermittedIdPAttributeValues("one", Collections.singletonList(bStringAttributeValue));
@@ -105,7 +105,7 @@ public class AttributeFilterWorkContextTest {
         context.addDeniedIdPAttributeValues("one", null);
         Assert.assertEquals(context.getDeniedAttributeValues().get("one").size(), 1);
 
-        context.addDeniedIdPAttributeValues("one", new ArrayList<IdPAttributeValue>());
+        context.addDeniedIdPAttributeValues("one", new ArrayList<IdPAttributeValue<?>>());
         Assert.assertEquals(context.getDeniedAttributeValues().get("one").size(), 1);
 
         context.addDeniedIdPAttributeValues("one", Collections.singletonList(bStringAttributeValue));
diff --git a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/saml/impl/MappedAttributeInMetadataMatcher.java b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/saml/impl/MappedAttributeInMetadataMatcher.java
index 97984fe..4109814 100644
--- a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/saml/impl/MappedAttributeInMetadataMatcher.java
+++ b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/saml/impl/MappedAttributeInMetadataMatcher.java
@@ -220,7 +220,7 @@ public class MappedAttributeInMetadataMatcher extends AbstractIdentifiableInitia
      * @return the result of the filter
      */
     @Nonnull private Set<IdPAttributeValue<?>> filterValues(@Nullable final IdPAttribute attribute,
-            @Nonnull @NonnullElements final List<? extends IdPAttributeValue> requestedValues) {
+            @Nonnull @NonnullElements final List<IdPAttributeValue<?>> requestedValues) {
 
         if (null == requestedValues || requestedValues.isEmpty()) {
             log.debug("{} Attribute {} found in metadata and no values specified", getLogPrefix(), attribute.getId());

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


More information about the commits mailing list