Package org.graalvm.polyglot.proxy
Interface ProxyInstant
- All Superinterfaces:
Proxy
,ProxyDate
,ProxyTime
,ProxyTimeZone
Interface to be implemented to mimic guest language objects that represents timestamps. This
interface also implements
ProxyDate
, ProxyTime
and ProxyTimeZone
.- Since:
- 19.2.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault LocalDate
asDate()
Returns the date information.Returns the instant information.default LocalTime
asTime()
Returns the time information.default ZoneId
Returns the timezone information.static ProxyInstant
Creates a new proxy instant from a Java instant value.
-
Method Details
-
asInstant
Instant asInstant()Returns the instant information. The returned value must not benull
. The following invariant must always hold for instant proxies:ProxyInstant proxy = ... ZoneId zone = proxy.getTimeZone(); LocalDate date = proxy.getDate(); LocalTime time = proxy.getTime(); assert ZonedDateTime.of(date, time, zone).equals(proxy.getInstant());
- Since:
- 19.2.0
-
asDate
Returns the date information. The returned value must not benull
. The invariant specified inasInstant()
must always hold for proxy instant values. -
asTime
Returns the time information. The returned value must not benull
. The invariant specified inasInstant()
must always hold for proxy instant values. -
asTimeZone
Returns the timezone information. The returned value must not benull
. The invariant specified inasInstant()
must always hold for proxy instant values.- Specified by:
asTimeZone
in interfaceProxyTimeZone
- Since:
- 19.2.0
- See Also:
-
from
Creates a new proxy instant from a Java instant value.- Since:
- 19.2.0
-