[spring-extensions] branch master updated: IDP-1434 Use null-preserving converter from String to Boolean

Rod Widdowson rdw at steadingsoftware.com
Tue May 7 10:33:29 EDT 2019


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

rdw pushed a commit to branch master
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=b0645d16a1d283acc738e6d5711ac52d8594a549

The following commit(s) were added to refs/heads/master by this push:
       new  b0645d1   IDP-1434 Use null-preserving converter from String to Boolean
b0645d1 is described below

commit b0645d16a1d283acc738e6d5711ac52d8594a549
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue May 7 15:10:50 2019 +0100

    IDP-1434 Use null-preserving converter from String to Boolean
    
    https://issues.shibboleth.net/jira/browse/IDP-1434
---
 .../net/shibboleth/ext/spring/util/SpringSupport.java    | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/main/java/net/shibboleth/ext/spring/util/SpringSupport.java b/src/main/java/net/shibboleth/ext/spring/util/SpringSupport.java
index cca7fb0..73d56a5 100644
--- a/src/main/java/net/shibboleth/ext/spring/util/SpringSupport.java
+++ b/src/main/java/net/shibboleth/ext/spring/util/SpringSupport.java
@@ -235,13 +235,27 @@ public final class SpringSupport {
      * @param attribute attribute whose value will be turned into a list
      * @return a bean which will generate a list of the values.
      */
-    @Nonnull public static AbstractBeanDefinition getAttributeValueAsList(@Nullable final Attr attribute) {
+    @Nonnull public static AbstractBeanDefinition getAttributeValueAsList(@Nonnull final Attr attribute) {
         final BeanDefinitionBuilder result =
                 BeanDefinitionBuilder.rootBeanDefinition(StringSupport.class, "stringToList");
         result.addConstructorArgValue(attribute.getValue());
         result.addConstructorArgValue(XMLConstants.LIST_DELIMITERS);
         return result.getBeanDefinition();
     }
+    
+    /**
+     * Gets the value of a boolean-type string as a (ptentially null) {@link Boolean}.
+     * 
+     * @param string value will be turned into a boolean (or null) (after property replacement)
+     * @return a bean which will generate a list of the values.
+     */
+    @Nullable public static AbstractBeanDefinition getStringValueAsBoolean(@Nullable final String string) {
+        final BeanDefinitionBuilder result =
+                BeanDefinitionBuilder.rootBeanDefinition(StringSupport.class, "booleanOf");
+        result.addConstructorArgValue(string);
+        return result.getBeanDefinition();
+    }
+
 
     /**
      * Gets the text content of a list of {@link Element}s as a {@link ManagedList}.

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


More information about the commits mailing list