7

Class Resolvers

 3 years ago
source link: https://nodatime.org/unstable/api/NodaTime.TimeZones.Resolvers.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Class Resolvers

Commonly-used implementations of the delegates used in resolving a LocalDateTime to a ZonedDateTime, and a method to combine two "partial" resolvers into a full one.
Since 1.0.x
Availability netstandard2.0
Inheritance
System.Object
Resolvers
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: NodaTime.TimeZones Assembly: NodaTime.dll
Syntax
public static class Resolvers
Remarks

Properties

LenientResolver

A ZoneLocalMappingResolver which never throws an exception due to ambiguity or skipped time.
Since 1.0.x
Availability netstandard2.0
Declaration
public static ZoneLocalMappingResolver LenientResolver { get; }
Property Value
Type Description ZoneLocalMappingResolver A ZoneLocalMappingResolver which never throws an exception due to ambiguity or skipped time.
Remarks
Ambiguity is handled by returning the earlier occurrence, and skipped times are shifted forward by the duration of the gap. This resolver combines ReturnEarlier and ReturnForwardShifted.

Note: The behavior of this resolver was changed in version 2.0 to fit the most commonly seen real-world usage pattern. Previous versions combined the ReturnLater and ReturnStartOfIntervalAfter resolvers, which can still be used separately if desired.

See Also

ReturnEarlier

An AmbiguousTimeResolver which returns the earlier of the two matching times.
Since 1.0.x
Availability netstandard2.0
Declaration
public static AmbiguousTimeResolver ReturnEarlier { get; }
Property Value
Type Description AmbiguousTimeResolver An AmbiguousTimeResolver which returns the earlier of the two matching times.

ReturnEndOfIntervalBefore

A SkippedTimeResolver which returns the final tick of the time zone interval before the "gap".
Since 1.0.x
Availability netstandard2.0
Declaration
public static SkippedTimeResolver ReturnEndOfIntervalBefore { get; }
Property Value
Type Description SkippedTimeResolver A SkippedTimeResolver which returns the final tick of the time zone interval before the "gap".

ReturnForwardShifted

A SkippedTimeResolver which shifts values in the "gap" forward by the duration of the gap (which is usually 1 hour). This corresponds to the instant that would have occured, had there not been a transition.
Since 2.0.x
Availability netstandard2.0
Declaration
public static SkippedTimeResolver ReturnForwardShifted { get; }
Property Value

Type Description SkippedTimeResolver A SkippedTimeResolver which shifts values in the "gap" forward by the duration of the gap (which is usually 1 hour).

ReturnLater

An AmbiguousTimeResolver which returns the later of the two matching times.
Since 1.0.x
Availability netstandard2.0
Declaration
public static AmbiguousTimeResolver ReturnLater { get; }
Property Value
Type Description AmbiguousTimeResolver An AmbiguousTimeResolver which returns the later of the two matching times.

ReturnStartOfIntervalAfter

A SkippedTimeResolver which returns the first tick of the time zone interval after the "gap".
Since 1.0.x
Availability netstandard2.0
Declaration
public static SkippedTimeResolver ReturnStartOfIntervalAfter { get; }
Property Value

Type Description SkippedTimeResolver A SkippedTimeResolver which returns the first tick of the time zone interval after the "gap".

StrictResolver

A ZoneLocalMappingResolver which only ever succeeds in the (usual) case where the result of the mapping is unambiguous.
Since 1.0.x
Availability netstandard2.0
Declaration
public static ZoneLocalMappingResolver StrictResolver { get; }
Property Value
Type Description ZoneLocalMappingResolver A ZoneLocalMappingResolver which only ever succeeds in the (usual) case where the result of the mapping is unambiguous.
Remarks
If the mapping is ambiguous or skipped, this throws SkippedTimeException or AmbiguousTimeException, as appropriate. This resolver combines ThrowWhenAmbiguous and ThrowWhenSkipped.
See Also

ThrowWhenAmbiguous

Since 1.0.x
Availability netstandard2.0
Declaration
public static AmbiguousTimeResolver ThrowWhenAmbiguous { get; }
Property Value

ThrowWhenSkipped

Since 1.0.x
Availability netstandard2.0
Declaration
public static SkippedTimeResolver ThrowWhenSkipped { get; }
Property Value

Methods

CreateMappingResolver(AmbiguousTimeResolver, SkippedTimeResolver)

Since 1.0.x
Availability netstandard2.0
Declaration
public static ZoneLocalMappingResolver CreateMappingResolver(AmbiguousTimeResolver ambiguousTimeResolver, SkippedTimeResolver skippedTimeResolver)
Parameters
Type Name Description AmbiguousTimeResolver ambiguousTimeResolver Resolver to use for ambiguous mappings. SkippedTimeResolver skippedTimeResolver Resolver to use for "skipped" mappings.
Returns
Type Description ZoneLocalMappingResolver The logical combination of the two resolvers.
Remarks
The ZoneLocalMappingResolver created by this method operates in the obvious way: unambiguous mappings are returned directly, ambiguous mappings are delegated to the given AmbiguousTimeResolver, and "skipped" mappings are delegated to the given SkippedTimeResolver.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK