org.keycloak.saml.processing.core.saml.v2.util

## Class XMLTimeUtil

- java.lang.Object
- - org.keycloak.saml.processing.core.saml.v2.util.XMLTimeUtil

-     public class XMLTimeUtil
      extends Object

  Util class dealing with xml based time
  Since:
    Jan 6, 2009
  Author:
    Anil.Saldhana@redhat.com

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLTimeUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static XMLGregorianCalendar` | `add(XMLGregorianCalendar value, long millis)` Add additional time in miliseconds
    `static String` | `getCurrentTimeZoneID()`
    `static XMLGregorianCalendar` | `getIssueInstant()` Get the current instant of time
    `static XMLGregorianCalendar` | `getIssueInstant(String timezone)` Returns a XMLGregorianCalendar in the timezone specified.
    `static long` | `inMilis(int valueInMins)` Convert the minutes into miliseconds
    `static boolean` | `isValid(XMLGregorianCalendar now, XMLGregorianCalendar notbefore, XMLGregorianCalendar notOnOrAfter)` Validate that the current time falls between the two boundaries
    `static XMLGregorianCalendar` | `parse(String timeString)` Given a string representing xml time, parse into `XMLGregorianCalendar`
    `static Duration` | `parseAsDuration(String timeValue)` Given a string, get the Duration object.
    `static XMLGregorianCalendar` | `subtract(XMLGregorianCalendar value, long millis)` Subtract some miliseconds from the time value

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XMLTimeUtil

          public XMLTimeUtil()

  - ### Method Detail

    - #### add

          public static XMLGregorianCalendar add(XMLGregorianCalendar value,
                                                 long millis)

      Add additional time in miliseconds
      Parameters:
        `value` - calendar whose value needs to be updated
        `millis` -
      Returns:
        calendar value with the addition

    - #### subtract

          public static XMLGregorianCalendar subtract(XMLGregorianCalendar value,
                                                      long millis)

      Subtract some miliseconds from the time value
      Parameters:
        `value` -
        `millis` - miliseconds entered in a positive value
      Returns:

    - #### getIssueInstant

          public static XMLGregorianCalendar getIssueInstant(String timezone)

      Returns a XMLGregorianCalendar in the timezone specified. If the timezone is not valid, then the timezone falls back to "GMT"
      Parameters:
        `timezone` -
      Returns:

    - #### getIssueInstant

          public static XMLGregorianCalendar getIssueInstant()

      Get the current instant of time
      Returns:

    - #### getCurrentTimeZoneID

          public static String getCurrentTimeZoneID()

    - #### inMilis

          public static long inMilis(int valueInMins)

      Convert the minutes into miliseconds
      Parameters:
        `valueInMins` -
      Returns:

    - #### isValid

          public static boolean isValid(XMLGregorianCalendar now,
                                        XMLGregorianCalendar notbefore,
                                        XMLGregorianCalendar notOnOrAfter)

      Validate that the current time falls between the two boundaries
      Parameters:
        `now` -
        `notbefore` -
        `notOnOrAfter` -
      Returns:

    - #### parseAsDuration

          public static Duration parseAsDuration(String timeValue)

      Given a string, get the Duration object. The string can be an ISO 8601 period representation (Eg.: P10M) or a numeric value. If a ISO 8601 period, the duration will reflect the defined format. If a numeric (Eg.: 1000) the duration will be calculated in milliseconds.
      Parameters:
        `timeValue` -
      Returns:

    - #### parse

          public static XMLGregorianCalendar parse(String timeString)

      Given a string representing xml time, parse into `XMLGregorianCalendar`
      Parameters:
        `timeString` -
      Returns:

Copyright © 2021 JBoss by Red Hat. All rights reserved.