Class XMLTimeUtil
java.lang.Object
org.keycloak.saml.processing.core.saml.v2.util.XMLTimeUtil
Util class dealing with xml based time
- Since:
- Jan 6, 2009
- Author:
- Anil.Saldhana@redhat.com
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic XMLGregorianCalendar
add
(XMLGregorianCalendar value, long millis) Add additional time in milisecondsstatic String
static XMLGregorianCalendar
Get the current instant of timestatic XMLGregorianCalendar
getIssueInstant
(String timezone) Returns a XMLGregorianCalendar in the timezone specified.static long
inMilis
(int valueInMins) Convert the minutes into milisecondsstatic boolean
isValid
(XMLGregorianCalendar now, XMLGregorianCalendar notbefore, XMLGregorianCalendar notOnOrAfter) Validate that the current time falls between the two boundariesstatic XMLGregorianCalendar
Given a string representing xml time, parse intoXMLGregorianCalendar
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
-
Constructor Details
-
XMLTimeUtil
public XMLTimeUtil()
-
-
Method Details
-
add
Add additional time in miliseconds- Parameters:
value
- calendar whose value needs to be updatedmillis
-- Returns:
- calendar value with the addition
-
subtract
Subtract some miliseconds from the time value- Parameters:
value
-millis
- miliseconds entered in a positive value- Returns:
-
getIssueInstant
Returns a XMLGregorianCalendar in the timezone specified. If the timezone is not valid, then the timezone falls back to "GMT"- Parameters:
timezone
-- Returns:
-
getIssueInstant
Get the current instant of time- Returns:
-
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
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
Given a string representing xml time, parse intoXMLGregorianCalendar
- Parameters:
timeString
-- Returns:
-