[java-metadata-aggregator] branch master updated: MDA-249 - Remove ItemCollectionWithMetadata

Ian Young ian at iay.org.uk
Thu Jul 9 09:21:19 UTC 2020


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

iay pushed a commit to branch master
in repository java-metadata-aggregator.

View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=9dd1b9707e73dad2ffc9680d13e18317bd51bad9

The following commit(s) were added to refs/heads/master by this push:
       new  9dd1b97   MDA-249 - Remove ItemCollectionWithMetadata
9dd1b97 is described below

commit 9dd1b9707e73dad2ffc9680d13e18317bd51bad9
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Thu Jul 9 10:18:55 2020 +0100

    MDA-249 - Remove ItemCollectionWithMetadata
    
    https://issues.shibboleth.net/jira/browse/MDA-249
---
 .../metadata/util/ItemCollectionWithMetadata.java  | 158 ---------------------
 .../metadata/util/ItemMetadataSupport.java         |  26 +---
 2 files changed, 1 insertion(+), 183 deletions(-)

diff --git a/aggregator-pipeline/src/main/java/net/shibboleth/metadata/util/ItemCollectionWithMetadata.java b/aggregator-pipeline/src/main/java/net/shibboleth/metadata/util/ItemCollectionWithMetadata.java
deleted file mode 100644
index 4aac879..0000000
--- a/aggregator-pipeline/src/main/java/net/shibboleth/metadata/util/ItemCollectionWithMetadata.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements.  See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.metadata.util;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import net.shibboleth.metadata.Item;
-import net.shibboleth.metadata.ItemMetadata;
-import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
-import net.shibboleth.utilities.java.support.collection.ClassToInstanceMultiMap;
-import net.shibboleth.utilities.java.support.collection.LazyList;
-import net.shibboleth.utilities.java.support.logic.Constraint;
-
-/**
- * A wrapper around a delegate collection that allows the collection to carry item metadata.
- * 
- * @param <T> type of items stored in this collection
- */
-public class ItemCollectionWithMetadata<T> implements Collection<Item<T>> {
-
-    /** The delegate collection. */
-    private final Collection<Item<T>> delegate;
-
-    /** Additional processing information associated with this collection of Items. */
-    private final ClassToInstanceMultiMap<ItemMetadata> metadata;
-
-    /** Constructor. */
-    public ItemCollectionWithMetadata() {
-        delegate = new LazyList<>();
-        metadata = new ClassToInstanceMultiMap<>(true);
-    }
-
-    /**
-     * Constructor.
-     * 
-     * @param wrappedCollection the underlying collection that holds the items
-     */
-    public ItemCollectionWithMetadata(@Nonnull @NonnullElements final Collection<Item<T>> wrappedCollection) {
-        delegate = Constraint.isNotNull(wrappedCollection, "Wrapped collection can not be null");
-        delegate.clear();
-
-        metadata = new ClassToInstanceMultiMap<>(true);
-    }
-
-    /**
-     * Gets the {@link ItemMetadata} for this collection.
-     * 
-     * @return the {@link ItemMetadata} for this collection, never null
-     */
-    @Nonnull @NonnullElements public ClassToInstanceMultiMap<ItemMetadata> getCollectionMetadata() {
-        return metadata;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int size() {
-        return delegate.size();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isEmpty() {
-        return delegate.isEmpty();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean contains(final Object o) {
-        return delegate.contains(o);
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nonnull @NonnullElements public Iterator<Item<T>> iterator() {
-        return delegate.iterator();
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nonnull @NonnullElements public Object[] toArray() {
-        return delegate.toArray();
-    }
-
-    /** {@inheritDoc} */
-    @Override @Nonnull @NonnullElements public <TT> TT[] toArray(@Nonnull final TT[] a) {
-        Constraint.isNotNull(a, "Target array can not be null");
-        return delegate.toArray(a);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean add(@Nullable final Item<T> e) {
-        if (e == null) {
-            return false;
-        }
-
-        return delegate.add(e);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean remove(@Nullable final Object o) {
-        if (o == null) {
-            return false;
-        }
-
-        return delegate.remove(o);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean containsAll(@Nonnull final Collection<?> c) {
-        Constraint.isNotNull(c, "Collection can not be null");
-
-        return delegate.containsAll(c);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean addAll(@Nullable final Collection<? extends Item<T>> c) {
-        if (c == null) {
-            return false;
-        }
-
-        return delegate.addAll(c);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean removeAll(@Nullable final Collection<?> c) {
-        if (c == null) {
-            return false;
-        }
-
-        return delegate.removeAll(c);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean retainAll(@Nonnull final Collection<?> c) {
-        Constraint.isNotNull(c, "Collection can not be null");
-
-        return delegate.retainAll(c);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clear() {
-        delegate.clear();
-    }
-}
\ No newline at end of file
diff --git a/aggregator-pipeline/src/main/java/net/shibboleth/metadata/util/ItemMetadataSupport.java b/aggregator-pipeline/src/main/java/net/shibboleth/metadata/util/ItemMetadataSupport.java
index 55b3b84..04ff00a 100644
--- a/aggregator-pipeline/src/main/java/net/shibboleth/metadata/util/ItemMetadataSupport.java
+++ b/aggregator-pipeline/src/main/java/net/shibboleth/metadata/util/ItemMetadataSupport.java
@@ -70,28 +70,4 @@ public final class ItemMetadataSupport {
         }
     }
 
-    /**
-     * Adds one or more {@link ItemMetadata} to the given collection if the collection is an instance of
-     * {@link ItemCollectionWithMetadata}.
-     * 
-     * @param itemCollection collection to which the metadata may be added
-     * @param itemMetadatas the metadata which may be added to the collection
-     * @param <T> type of item in the collections
-     */
-    public static <T> void addToCollection(@Nullable final Collection<Item<T>> itemCollection,
-            @Nullable @NullableElements final Iterable<? extends ItemMetadata> itemMetadatas) {
-        if (itemCollection == null || !(itemCollection instanceof ItemCollectionWithMetadata)) {
-            return;
-        }
-        if (itemMetadatas == null) {
-            return;
-        }
-
-        final ItemCollectionWithMetadata<T> collection = (ItemCollectionWithMetadata<T>) itemCollection;
-        for (final ItemMetadata metadata : itemMetadatas) {
-            if (metadata != null) {
-                collection.getCollectionMetadata().put(metadata);
-            }
-        }
-    }
-}
\ No newline at end of file
+}

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


More information about the commits mailing list