Package org.omnifaces.cdi.config
Class DateProducer.TemporalDate
- java.lang.Object
-
- org.omnifaces.cdi.config.DateProducer.TemporalDate
-
- All Implemented Interfaces:
Serializable
,Comparable<DateProducer.TemporalDate>
,Temporal
,TemporalAccessor
- Enclosing class:
- DateProducer
public static class DateProducer.TemporalDate extends Object implements Temporal, Comparable<DateProducer.TemporalDate>, Serializable
ZonedDateTime
is a final class, hence this proxy for CDI. Plus, it also offers a fallback for existing EL expressions relying onDate.getTime()
such as#{now.time}
so that they continue working after migration fromDate
toTemporal
in OmniFaces 4.0.- Since:
- 4.0
- Author:
- Bauke Scholtz
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TemporalDate()
Constructs a new proxyable temporal date which is initialized withZonedDateTime.now()
.TemporalDate(ZonedDateTime zonedDateTime)
Constructs a new proxyable temporal date which is initialized with givenZonedDateTime
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(DateProducer.TemporalDate other)
boolean
equals(Object other)
ReturnsZonedDateTime.equals(Object)
Instant
getInstant()
Convenience method to return this temporal date asInstant
atZoneOffset.UTC
.long
getLong(TemporalField field)
long
getTime()
Has the same signature asDate.getTime()
.ZonedDateTime
getZonedDateTime()
Convenience method to return this temporal date asZonedDateTime
atZoneId.systemDefault()
.int
hashCode()
ReturnsZonedDateTime.hashCode()
boolean
isSupported(TemporalField field)
boolean
isSupported(TemporalUnit unit)
Temporal
plus(long amountToAdd, TemporalUnit unit)
String
toString()
ReturnsZonedDateTime.toString()
.long
until(Temporal endExclusive, TemporalUnit unit)
Temporal
with(TemporalField field, long newValue)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.time.temporal.TemporalAccessor
get, query, range
-
-
-
-
Constructor Detail
-
TemporalDate
public TemporalDate()
Constructs a new proxyable temporal date which is initialized withZonedDateTime.now()
.
-
TemporalDate
public TemporalDate(ZonedDateTime zonedDateTime)
Constructs a new proxyable temporal date which is initialized with givenZonedDateTime
.- Parameters:
zonedDateTime
- ZonedDateTime to initialize with.
-
-
Method Detail
-
getZonedDateTime
public ZonedDateTime getZonedDateTime()
Convenience method to return this temporal date asZonedDateTime
atZoneId.systemDefault()
.- Returns:
- This as
ZonedDateTime
atZoneId.systemDefault()
.
-
getInstant
public Instant getInstant()
Convenience method to return this temporal date asInstant
atZoneOffset.UTC
.- Returns:
- This as
Instant
atZoneOffset.UTC
.
-
getTime
public long getTime()
Has the same signature asDate.getTime()
. This ensures that#{now.time}
and#{startup.time}
keep working.- Returns:
- The number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this temporal date.
-
compareTo
public int compareTo(DateProducer.TemporalDate other)
- Specified by:
compareTo
in interfaceComparable<DateProducer.TemporalDate>
-
equals
public boolean equals(Object other)
ReturnsZonedDateTime.equals(Object)
-
hashCode
public int hashCode()
ReturnsZonedDateTime.hashCode()
-
toString
public String toString()
ReturnsZonedDateTime.toString()
.
-
isSupported
public boolean isSupported(TemporalField field)
- Specified by:
isSupported
in interfaceTemporalAccessor
-
getLong
public long getLong(TemporalField field)
- Specified by:
getLong
in interfaceTemporalAccessor
-
isSupported
public boolean isSupported(TemporalUnit unit)
- Specified by:
isSupported
in interfaceTemporal
-
with
public Temporal with(TemporalField field, long newValue)
-
plus
public Temporal plus(long amountToAdd, TemporalUnit unit)
-
until
public long until(Temporal endExclusive, TemporalUnit unit)
-
-