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:
- [email protected]
-
-
Constructor Summary
Constructors Constructor Description XMLTimeUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static XMLGregorianCalendar
add(XMLGregorianCalendar value, long millis)
Add additional time in milisecondsstatic String
getCurrentTimeZoneID()
static XMLGregorianCalendar
getIssueInstant()
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
parse(String timeString)
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
-
-
-
Method Detail
-
add
public static XMLGregorianCalendar add(XMLGregorianCalendar value, long millis)
Add additional time in miliseconds- Parameters:
value
- calendar whose value needs to be updatedmillis
-- 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 intoXMLGregorianCalendar
- Parameters:
timeString
-- Returns:
-
-