[spring-extensions] branch main updated: Allow repeated calls to setter.
Scott Cantor
cantor.2 at osu.edu
Tue Aug 18 15:40:21 UTC 2020
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository spring-extensions.
View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=d0afb53a9f55e79f01df739cfd3e6b9ce296745d
The following commit(s) were added to refs/heads/main by this push:
new d0afb53 Allow repeated calls to setter.
d0afb53 is described below
commit d0afb53a9f55e79f01df739cfd3e6b9ce296745d
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Aug 18 11:40:13 2020 -0400
Allow repeated calls to setter.
---
.../ext/spring/util/IdentifiedComponentManager.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/main/java/net/shibboleth/ext/spring/util/IdentifiedComponentManager.java b/src/main/java/net/shibboleth/ext/spring/util/IdentifiedComponentManager.java
index 08a89a1..4a31345 100644
--- a/src/main/java/net/shibboleth/ext/spring/util/IdentifiedComponentManager.java
+++ b/src/main/java/net/shibboleth/ext/spring/util/IdentifiedComponentManager.java
@@ -49,9 +49,12 @@ public class IdentifiedComponentManager<T extends IdentifiedComponent> {
/** Class logger. */
@Nonnull private Logger log = LoggerFactory.getLogger(IdentifiedComponentManager.class);
+ /** Initial component list. */
+ @Nonnull @NonnullElements private Collection<T> initialComponents;
+
/** Underlying collection. */
@Nonnull @NonnullElements private Collection<T> components;
-
+
/**
* Auto-wiring point for free-standing objects.
*
@@ -59,10 +62,11 @@ public class IdentifiedComponentManager<T extends IdentifiedComponent> {
*/
public IdentifiedComponentManager(@Nullable @NonnullElements final Collection<T> freeObjects) {
if (freeObjects != null) {
- components = List.copyOf(freeObjects);
+ initialComponents = List.copyOf(freeObjects);
} else {
- components = Collections.emptyList();
+ initialComponents = Collections.emptyList();
}
+ components = initialComponents;
}
/**
@@ -77,7 +81,7 @@ public class IdentifiedComponentManager<T extends IdentifiedComponent> {
if (additionalObjects != null) {
final Collection<T> holder = new LinkedHashSet<>(additionalObjects);
holder.addAll(
- components.stream()
+ initialComponents.stream()
.filter(obj -> {
if (holder.contains(obj)) {
log.info("Replacing auto-wired component: {}", obj.getId());
@@ -87,6 +91,8 @@ public class IdentifiedComponentManager<T extends IdentifiedComponent> {
})
.collect(Collectors.toUnmodifiableList()));
components = List.copyOf(holder);
+ } else {
+ components = initialComponents;
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list