public class DateProducer extends Object
Producer for #{startup}
and #{now}
.
Since 4.0 it produces by default an instance of Temporal
whereas it previously produced an instance of
Date
.
Historical note: since 1.0 these were registered as beans in faces-config.xml. Since 3.6 these were migrated to CDI producers, because the CDI implementation being used may emit warnings on them not being proxyable.
Temporal
via #{startup}
in EL.Temporal
via #{now}
in EL.DateProducer.TemporalDate.getTime()
method which allows you to obtain the epoch time via
#{startup.time}
and #{now.time}
in EL.DateProducer.TemporalDate.getInstant()
method which allows you to convert them to Instant
via
#{startup.instant}
and #{now.instant}
in EL.DateProducer.TemporalDate.getZonedDateTime()
method which allows you to convert them to
ZonedDateTime
via #{startup.zonedDateTime}
and #{now.zonedDateTime}
in EL.@Inject @Named private Temporal startup;
.
Modifier and Type | Class and Description |
---|---|
static class |
DateProducer.TemporalDate
Instant is a final class, hence this proxy for CDI. |
Constructor and Description |
---|
DateProducer() |
Modifier and Type | Method and Description |
---|---|
DateProducer.TemporalDate |
getNow()
This makes an instance of
Temporal as current datetime available by #{now} . |
DateProducer.TemporalDate |
getStartup()
This makes an instance of
Temporal as startup datetime available by #{startup} . |
@Produces @Named @ApplicationScoped @Eager public DateProducer.TemporalDate getStartup()
Temporal
as startup datetime available by #{startup}
.@Produces @Named @RequestScoped public DateProducer.TemporalDate getNow()
Temporal
as current datetime available by #{now}
.Copyright © 2012–2020 OmniFaces. All rights reserved.