Table of Contents

AdjustmentHandlerContext Class

Definition

Namespace
Bodu.Globalization.Calendar
Assembly
Bodu.Globalization.Calendar.dll
Package
Bodu.Globalization.Calendar 1.0.1
Source
AdjustmentHandlerContext.cs

Provides an IAdjustmentHandler with the information needed to compute an observed date: the calculated occurrence date, the requesting territory, the firing policy, and access to the surrounding resolution context.

public sealed class AdjustmentHandlerContext
Inheritance
AdjustmentHandlerContext
Inherited Members
Extension Methods

Constructors

AdjustmentHandlerContext(DateOnly, string, AdjustmentPolicy, Func<DateOnly, bool>, StrategyResolutionContext)

Initializes a new instance of the AdjustmentHandlerContext class.

public AdjustmentHandlerContext(DateOnly baseDate, string territory, AdjustmentPolicy policy, Func<DateOnly, bool> isOccupied, StrategyResolutionContext resolutionContext)

Parameters

baseDate DateOnly

The calculated (actual) occurrence date.

territory string

The territory code the resolution was requested for.

policy AdjustmentPolicy

The adjustment policy whose custom action is firing.

isOccupied Func<DateOnly, bool>

A predicate reporting whether a candidate day is already claimed.

resolutionContext StrategyResolutionContext

The resolution context used to resolve referenced rules.

Exceptions

ArgumentNullException

territory, policy, isOccupied, or resolutionContext is null.

Properties

BaseDate

Gets the calculated (actual) occurrence date the handler adjusts.

public DateOnly BaseDate { get; }

Property Value

DateOnly

The calculated date.

Parameters

Gets the author-supplied parameters declared by the policy.

public IReadOnlyDictionary<string, string> Parameters { get; }

Property Value

IReadOnlyDictionary<string, string>

The policy's HandlerParameters; empty when none are declared.

Policy

Gets the adjustment policy whose custom action is firing.

public AdjustmentPolicy Policy { get; }

Property Value

AdjustmentPolicy

The firing AdjustmentPolicy.

ResolutionContext

Gets the resolution context the handler can use to resolve referenced rules for the same year.

public StrategyResolutionContext ResolutionContext { get; }

Property Value

StrategyResolutionContext

The StrategyResolutionContext.

Territory

Gets the territory code the resolution was requested for.

public string Territory { get; }

Property Value

string

The requested territory code.

Methods

IsOccupied(DateOnly)

Determines whether a candidate day is already claimed by another non-working occurrence.

public bool IsOccupied(DateOnly date)

Parameters

date DateOnly

The candidate day to test.

Returns

bool

true when the day is already claimed; otherwise false.

Applies to

ProductVersions
.NET8, 10