다음을 통해 공유


ITemporalField.IsSupportedBy(ITemporalAccessor) Method

Definition

Checks if this field is supported by the temporal object.

[Android.Runtime.Register("isSupportedBy", "(Ljava/time/temporal/TemporalAccessor;)Z", "GetIsSupportedBy_Ljava_time_temporal_TemporalAccessor_Handler:Java.Time.Temporal.ITemporalFieldInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)]
public bool IsSupportedBy (Java.Time.Temporal.ITemporalAccessor? temporal);
[<Android.Runtime.Register("isSupportedBy", "(Ljava/time/temporal/TemporalAccessor;)Z", "GetIsSupportedBy_Ljava_time_temporal_TemporalAccessor_Handler:Java.Time.Temporal.ITemporalFieldInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=26)>]
abstract member IsSupportedBy : Java.Time.Temporal.ITemporalAccessor -> bool

Parameters

temporal
ITemporalAccessor

the temporal object to query, not null

Returns

true if the date-time can be queried for this field, false if not

Attributes

Remarks

Checks if this field is supported by the temporal object.

This determines whether the temporal accessor supports this field. If this returns false, then the temporal cannot be queried for this field.

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

// these two lines are equivalent, but the second approach is recommended
              temporal = thisField.isSupportedBy(temporal);
              temporal = temporal.isSupported(thisField);

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

Implementations should determine whether they are supported using the fields available in ChronoField.

Java documentation for java.time.temporal.TemporalField.isSupportedBy(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