[java-support] branch master updated: JSPT-79 - Review date and time handling for Java 8

Scott Cantor cantor.2 at osu.edu
Thu Mar 14 16:34:05 EDT 2019


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

scantor pushed a commit to branch master
in repository java-support.

View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=983be19ce7ee644617667ca235772d9725b9448f

The following commit(s) were added to refs/heads/master by this push:
       new  983be19   JSPT-79 - Review date and time handling for Java 8
983be19 is described below

commit 983be19ce7ee644617667ca235772d9725b9448f
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Mar 14 16:34:03 2019 -0400

    JSPT-79 - Review date and time handling for Java 8
    
    https://issues.shibboleth.net/jira/browse/JSPT-79
    
    Add provisional Duration helper/creator to DOMTypeSupport.
---
 .../shibboleth/utilities/java/support/xml/DOMTypeSupport.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java b/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java
index 60b93de..8c68872 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/xml/DOMTypeSupport.java
@@ -84,6 +84,17 @@ public final class DOMTypeSupport {
     public static long durationToLong(final Duration duration) {
         return duration.getTimeInMillis(baseline);
     }
+
+    /**
+     * Converts a lexical duration, as defined by XML Schema 1.0, into a {@link java.time.Duration}.
+     * 
+     * @param duration lexical duration representation
+     * 
+     * @return duration in Java form
+     */
+    public static java.time.Duration durationToDuration(final String duration) {
+        return java.time.Duration.ofMillis(durationToLong(duration));
+    }
     
     /**
      * Gets a static instance of a JAXP DatatypeFactory.

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


More information about the commits mailing list