java.lang.Object
net.fortuna.ical4j.model.TemporalAdapter<T>
- Type Parameters:
T- A concrete implementation ofTemporal
- All Implemented Interfaces:
Serializable
The iCalendar specification supports multiple representations of date/time values, as outlined
below. This class encapsulates a
Temporal value
and provides support for all corresponding representations in the specification.
The recommended Temporal implementations for use with iCal4j are as follows:
LocalDate- represents an iCalendar DATE value as defined in section 3.3.4 of RFC5545LocalDateTime- represents an iCalendar FORM #1: DATE-TIME value as defined in section 3.3.5 of RFC5545Instant- represents an iCalendar FORM #2: DATE-TIME value as defined in section 3.3.5 of RFC5545ZonedDateTime- represents an iCalendar FORM #3: DATE-TIME value as defined in section 3.3.5 of RFC5545
ZoneId for calculations such as
recurrence inclusions and other date-based comparisons. Use isFloating(Temporal) to determine floating
instances.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTemporalAdapter(TemporalAdapter<T> adapter) TemporalAdapter(T temporal) TemporalAdapter(T temporal, TimeZoneRegistry timeZoneRegistry) -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic TemporalAdapter<?>inthashCode()static <T extends Temporal>
booleanisAfter(T date1, T date2) static <T extends Temporal>
booleanisBefore(T date1, T date2) static booleanisDateTimePrecision(Temporal date) Indicates whether the temporal type represents a date/time value.static booleanisFloating(Temporal date) Indicates whether the temporal type represents a "floating" date/time value.static booleanIndicates whether the temporal type represents a UTC date/time value.static <T extends Temporal>
TemporalAdapter<T>Parse a string representation of a temporal value.static TemporalAdapter<ZonedDateTime>Parse a string representation of a temporal value applicable to the specified timezone.static <T extends Temporal>
TemporalAdapter<T>parse(String value, CalendarDateFormat parseFormat) static TemporalAdapter<ZonedDateTime>Parse a string representation of a temporal value applicable to the specified timezone.static TemporalAdapter<ZonedDateTime>parse(String value, TzId tzId, TimeZoneRegistry timeZoneRegistry) static ZonedDateTimetoLocalTime(Temporal temporal, ZoneId zoneId) toLocalTime(ZoneId zoneId) toString()
-
Constructor Details
-
TemporalAdapter
-
TemporalAdapter
-
TemporalAdapter
-
-
Method Details
-
getTemporal
-
toString
-
toString
-
toLocalTime
-
toLocalTime
-
toLocalTime
-
parse
public static <T extends Temporal> TemporalAdapter<T> parse(String value) throws DateTimeParseException Parse a string representation of a temporal value.- Parameters:
value- a string representing a temporal- Returns:
- an adapter containing the parsed temporal value and format type
- Throws:
DateTimeParseException- if the string cannot be parsed
-
parse
public static <T extends Temporal> TemporalAdapter<T> parse(String value, CalendarDateFormat parseFormat) throws DateTimeParseException - Throws:
DateTimeParseException
-
parse
Parse a string representation of a temporal value applicable to the specified timezone.- Parameters:
value- a string representing a floating temporal valuezoneId- a timezone applied to the parsed value- Returns:
- an adapter containing the parsed temporal value
- Throws:
DateTimeParseException- if the string cannot be parsed
-
parse
Parse a string representation of a temporal value applicable to the specified timezone.- Parameters:
value- a string representing a floating temporal valuetzId- a timezone applied to the parsed value- Returns:
- an adapter containing the parsed temporal value
- Throws:
DateTimeParseException- if the string cannot be parsed
-
parse
public static TemporalAdapter<ZonedDateTime> parse(String value, TzId tzId, TimeZoneRegistry timeZoneRegistry) - Parameters:
value- a string representing a floating temporal valuetzId- a timezone applied to the parsed valuetimeZoneRegistry- timezone definitions- Returns:
-
from
This method provides support for conversion of legacyDateandDateTimeinstances to temporal values.- Parameters:
date- a date/time instance- Returns:
- a temporal adapter instance equivalent to the specified date/time value
-
isFloating
Indicates whether the temporal type represents a "floating" date/time value.- Returns:
- true if the temporal type is floating, otherwise false
-
isUtc
Indicates whether the temporal type represents a UTC date/time value. A temporal is defined as UTC if it matches any of the following: - does not have associated zone information (e.g. Instant or OffsetDateTime) - where offset is supported the offset must be zero- Returns:
- true if the temporal type is in UTC time, otherwise false
-
isDateTimePrecision
Indicates whether the temporal type represents a date/time value.- Returns:
- true if the temporal type has DATE-TIME precision, otherwise false
-
isBefore
-
isAfter
-
equals
-
hashCode
public int hashCode()
-