T
- A concrete implementation of Temporal
public class TemporalAdapter<T extends Temporal> extends Object implements Serializable
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 RFC5545ZoneId
for calculations such as
recurrence inclusions and other date-based comparisons. Use isFloating(Temporal)
to determine floating
instances.Constructor and Description |
---|
TemporalAdapter(T temporal) |
TemporalAdapter(TemporalAdapter<T> adapter) |
TemporalAdapter(T temporal,
TimeZoneRegistry timeZoneRegistry) |
Modifier and Type | Method and Description |
---|---|
static TemporalAdapter |
from(Date date)
|
T |
getTemporal() |
static <T extends Temporal> |
isAfter(T date1,
T date2) |
static <T extends Temporal> |
isBefore(T date1,
T date2) |
static boolean |
isFloating(Temporal date)
Indicates whether the temporal type represents a "floating" date/time value.
|
static boolean |
isUtc(Temporal date)
Indicates whether the temporal type represents a UTC date/time value.
|
static <T extends Temporal> |
parse(String value)
Parse a string representation of a temporal value.
|
static TemporalAdapter<ZonedDateTime> |
parse(String value,
TzId tzId)
Parse a string representation of a temporal value applicable to the specified timezone.
|
static TemporalAdapter<ZonedDateTime> |
parse(String value,
TzId tzId,
TimeZoneRegistry timeZoneRegistry) |
static TemporalAdapter<ZonedDateTime> |
parse(String value,
ZoneId zoneId)
Parse a string representation of a temporal value applicable to the specified timezone.
|
ZonedDateTime |
toLocalTime() |
ZonedDateTime |
toLocalTime(ZoneId zoneId) |
String |
toString() |
String |
toString(ZoneId zoneId) |
public TemporalAdapter(TemporalAdapter<T> adapter)
public TemporalAdapter(T temporal)
public TemporalAdapter(T temporal, TimeZoneRegistry timeZoneRegistry)
public T getTemporal()
public ZonedDateTime toLocalTime()
public ZonedDateTime toLocalTime(ZoneId zoneId)
public static <T extends Temporal> TemporalAdapter<T> parse(String value) throws DateTimeParseException
value
- a string representing a temporalDateTimeParseException
- if the string cannot be parsedpublic static TemporalAdapter<ZonedDateTime> parse(String value, ZoneId zoneId)
value
- a string representing a floating temporal valuezoneId
- a timezone applied to the parsed valueDateTimeParseException
- if the string cannot be parsedpublic static TemporalAdapter<ZonedDateTime> parse(String value, TzId tzId)
value
- a string representing a floating temporal valuetzId
- a timezone applied to the parsed valueDateTimeParseException
- if the string cannot be parsedpublic static TemporalAdapter<ZonedDateTime> parse(String value, TzId tzId, TimeZoneRegistry timeZoneRegistry)
value
- a string representing a floating temporal valuetzId
- a timezone applied to the parsed valuetimeZoneRegistry
- timezone definitionspublic static TemporalAdapter from(Date date)
Date
and DateTime
instances to temporal
values.date
- a date/time instancepublic static boolean isFloating(Temporal date)
public static boolean isUtc(Temporal date)
public static <T extends Temporal> boolean isBefore(T date1, T date2)
public static <T extends Temporal> boolean isAfter(T date1, T date2)