Share via


ITemporal Interface

Definition

Framework-level interface defining read-write access to a temporal object, such as a date, time, offset or some combination of these.

[Android.Runtime.Register("java/time/temporal/Temporal", "", "Java.Time.Temporal.ITemporalInvoker", ApiSince=26)]
public interface ITemporal : IDisposable, Java.Interop.IJavaPeerable, Java.Time.Temporal.ITemporalAccessor
[<Android.Runtime.Register("java/time/temporal/Temporal", "", "Java.Time.Temporal.ITemporalInvoker", ApiSince=26)>]
type ITemporal = interface
    interface ITemporalAccessor
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Derived
Attributes
Implements

Remarks

Framework-level interface defining read-write access to a temporal object, such as a date, time, offset or some combination of these.

This is the base interface type for date, time and offset objects that are complete enough to be manipulated using plus and minus. It is implemented by those classes that can provide and manipulate information as TemporalField fields or TemporalQuery queries. See TemporalAccessor for the read-only version of this interface.

Most date and time information can be represented as a number. These are modeled using TemporalField with the number held using a long to handle large values. Year, month and day-of-month are simple examples of fields, but they also include instant and offsets. See ChronoField for the standard set of fields.

Two pieces of date/time information cannot be represented by numbers, the java.time.chrono.Chronology chronology and the java.time.ZoneId time-zone. These can be accessed via #query(TemporalQuery) queries using the static methods defined on TemporalQuery.

This interface is a framework-level interface that should not be widely used in application code. Instead, applications should create and pass around instances of concrete types, such as LocalDate. There are many reasons for this, part of which is that implementations of this interface may be in calendar systems other than ISO. See java.time.chrono.ChronoLocalDate for a fuller discussion of the issues.

<h2>When to implement</h2>

A class should implement this interface if it meets three criteria: <ul> <li>it provides access to date/time/offset information, as per TemporalAccessor<li>the set of fields are contiguous from the largest to the smallest <li>the set of fields are complete, such that no other field is needed to define the valid range of values for the fields that are represented </ul>

Four examples make this clear: <ul> <li>LocalDate implements this interface as it represents a set of fields that are contiguous from days to forever and require no external information to determine the validity of each date. It is therefore able to implement plus/minus correctly. <li>LocalTime implements this interface as it represents a set of fields that are contiguous from nanos to within days and require no external information to determine validity. It is able to implement plus/minus correctly, by wrapping around the day. <li>MonthDay, the combination of month-of-year and day-of-month, does not implement this interface. While the combination is contiguous, from days to months within years, the combination does not have sufficient information to define the valid range of values for day-of-month. As such, it is unable to implement plus/minus correctly. <li>The combination day-of-week and day-of-month ("Friday the 13th") should not implement this interface. It does not represent a contiguous set of fields, as days to weeks overlaps days to months. </ul>

Added in 1.8.

Java documentation for java.time.temporal.Temporal.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Properties

Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
JniIdentityHashCode

Returns the value of java.lang.System.identityHashCode() for the wrapped instance.

(Inherited from IJavaPeerable)
JniManagedPeerState

State of the managed peer.

(Inherited from IJavaPeerable)
JniPeerMembers

Member access and invocation support.

(Inherited from IJavaPeerable)
PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)

Methods

Disposed()

Called when the instance has been disposed.

(Inherited from IJavaPeerable)
DisposeUnlessReferenced()

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

(Inherited from IJavaPeerable)
Finalized()

Called when the instance has been finalized.

(Inherited from IJavaPeerable)
Get(ITemporalField)

Gets the value of the specified field as an int.

(Inherited from ITemporalAccessor)
GetLong(ITemporalField)

Gets the value of the specified field as a long.

(Inherited from ITemporalAccessor)
IsSupported(ITemporalField)

Checks if the specified field is supported.

(Inherited from ITemporalAccessor)
IsSupported(ITemporalUnit)

Checks if the specified unit is supported.

Minus(Int64, ITemporalUnit)

Returns an object of the same type as this object with the specified period subtracted.

Minus(ITemporalAmount)

Returns an object of the same type as this object with an amount subtracted.

Plus(Int64, ITemporalUnit)

Returns an object of the same type as this object with the specified period added.

Plus(ITemporalAmount)

Returns an object of the same type as this object with an amount added.

Query(ITemporalQuery)

Queries this date-time.

(Inherited from ITemporalAccessor)
Range(ITemporalField)

Gets the range of valid values for the specified field.

(Inherited from ITemporalAccessor)
SetJniIdentityHashCode(Int32)

Set the value returned by JniIdentityHashCode.

(Inherited from IJavaPeerable)
SetJniManagedPeerState(JniManagedPeerStates) (Inherited from IJavaPeerable)
SetPeerReference(JniObjectReference)

Set the value returned by PeerReference.

(Inherited from IJavaPeerable)
UnregisterFromRuntime()

Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations.

(Inherited from IJavaPeerable)
Until(ITemporal, ITemporalUnit)

Calculates the amount of time until another temporal in terms of the specified unit.

With(ITemporalAdjuster)

Returns an adjusted object of the same type as this object with the adjustment made.

With(ITemporalField, Int64)

Returns an object of the same type as this object with the specified field altered.

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to