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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic XMLGregorianCalendaradd(XMLGregorianCalendar value, long millis) Add additional time in milisecondsstatic Stringstatic XMLGregorianCalendarGet the current instant of timestatic XMLGregorianCalendargetIssueInstant(String timezone) Returns a XMLGregorianCalendar in the timezone specified.static longinMilis(int valueInMins) Convert the minutes into milisecondsstatic booleanisValid(XMLGregorianCalendar now, XMLGregorianCalendar notbefore, XMLGregorianCalendar notOnOrAfter) Validate that the current time falls between the two boundariesstatic XMLGregorianCalendarGiven a string representing xml time, parse intoXMLGregorianCalendarstatic DurationparseAsDuration(String timeValue) Given a string, get the Duration object.static XMLGregorianCalendarsubtract(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:
-