public class GeneralizedTime extends Object implements Comparable<GeneralizedTime>
Calendar
and LDAP generalized time syntax as defined in
RFC 4517 section 3.3.13.
Copied and adapted from Apache Directory shared-ldap.Modifier and Type | Class and Description |
---|---|
static class |
GeneralizedTime.Format |
static class |
GeneralizedTime.FractionDelimiter |
static class |
GeneralizedTime.TimeZoneFormat |
Constructor and Description |
---|
GeneralizedTime(Calendar calendar)
Creates a new instance of GeneralizedTime, based on the given Calendar object.
|
GeneralizedTime(String generalizedTime)
Creates a new instance of GeneralizedTime, based on the given generalized time string.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(GeneralizedTime other)
Compares this GeneralizedTime object with the specified GeneralizedTime object.
|
boolean |
equals(Object obj) |
Calendar |
getCalendar()
Gets the calendar.
|
int |
hashCode() |
String |
toGeneralizedTime()
Returns the string representation of this generalized time.
|
String |
toGeneralizedTime(GeneralizedTime.Format format,
GeneralizedTime.FractionDelimiter fractionDelimiter,
int fractionLength,
GeneralizedTime.TimeZoneFormat timeZoneFormat)
Returns the string representation of this generalized time.
|
String |
toString() |
public GeneralizedTime(Calendar calendar)
Format.YEAR_MONTH_DAY_HOUR_MIN_SECas default format and
TimeZoneFormat.Zas default time zone format.
calendar
- the calendar containing the date, time and timezone informationpublic GeneralizedTime(String generalizedTime) throws ParseException
generalizedTime
- the generalized timeParseException
- if the given generalized time can't be parsed.public String toGeneralizedTime()
public String toGeneralizedTime(GeneralizedTime.Format format, GeneralizedTime.FractionDelimiter fractionDelimiter, int fractionLength, GeneralizedTime.TimeZoneFormat timeZoneFormat)
format
- the target formatfractionDelimiter
- the target fraction delimiter, may be nullfractionLength
- the fraction lengthtimeZoneFormat
- the target time zone formatpublic Calendar getCalendar()
GeneralizedTime
settings.public int compareTo(GeneralizedTime other)
compareTo
in interface Comparable<GeneralizedTime>
other
- the other GeneralizedTime objectComparable.compareTo(java.lang.Object)
Copyright © 2020. All rights reserved.