Freigeben über


ITemporalField.RangeRefinedBy(ITemporalAccessor) Method

Definition

Get the range of valid values for this field using the temporal object to refine the result.

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

Parameters

temporal
ITemporalAccessor

the temporal object used to refine the result, not null

Returns

the range of valid values for this field, not null

Attributes

Remarks

Get the range of valid values for this field using the temporal object to refine the result.

This uses the temporal object to find the range of valid values for the field. This is similar to #range(), however this method refines the result using the temporal. For example, if the field is DAY_OF_MONTH the range method is not accurate as there are four possible month lengths, 28, 29, 30 and 31 days. Using this method with a date allows the range to be accurate, returning just one of those four options.

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

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

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

Implementations should perform any queries or calculations using the fields available in ChronoField. If the field is not supported an UnsupportedTemporalTypeException must be thrown.

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