Share via


ITemporalQuery.QueryFrom(ITemporalAccessor) Method

Definition

Queries the specified temporal object.

[Android.Runtime.Register("queryFrom", "(Ljava/time/temporal/TemporalAccessor;)Ljava/lang/Object;", "GetQueryFrom_Ljava_time_temporal_TemporalAccessor_Handler:Java.Time.Temporal.ITemporalQueryInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public Java.Lang.Object? QueryFrom (Java.Time.Temporal.ITemporalAccessor? temporal);
[<Android.Runtime.Register("queryFrom", "(Ljava/time/temporal/TemporalAccessor;)Ljava/lang/Object;", "GetQueryFrom_Ljava_time_temporal_TemporalAccessor_Handler:Java.Time.Temporal.ITemporalQueryInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member QueryFrom : Java.Time.Temporal.ITemporalAccessor -> Java.Lang.Object

Parameters

temporal
ITemporalAccessor

the temporal object to query, not null

Returns

the queried value, may return null to indicate not found

Attributes

Remarks

Queries the specified temporal object.

This queries the specified temporal object to return an object using the logic encapsulated in the implementing class. Examples might be a query that checks if the date is the day before February 29th in a leap year, or calculates the number of days to your next birthday.

There are two equivalent ways of using this method. The first is to invoke this method directly. The second is to use TemporalAccessor#query(TemporalQuery):

// these two lines are equivalent, but the second approach is recommended
              temporal = thisQuery.queryFrom(temporal);
              temporal = temporal.query(thisQuery);

It is recommended to use the second approach, query(TemporalQuery), as it is a lot clearer to read in code.

Java documentation for java.time.temporal.TemporalQuery.queryFrom(java.time.temporal.TemporalAccessor).

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.

Applies to