Class ValueObjectBound
Namespace: AdCodicem.ValueObjects
Assembly: AdCodicem.ValueObjects.Abstractions.dll
A generic bridge to the bounds a value object declares through
public static class ValueObjectBound
Inheritance
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
A static abstract member is reached through a type parameter, which finds it however the value object implements
it. Named on the type, BirthDate.Minimum would miss an explicit implementation and fail to compile in a file
the consumer cannot edit.
The bound is read from the value object each time it is asked for, and nothing keeps it. A bound is a constant, which the JIT folds into the check that reads it, so a copy would save nothing; and a copy taken while the value object's own static fields are still being initialized, by a well-known instance created before the bound is assigned, would keep the default of the type for the life of the process.
Methods
Maximum<TSelf, TValue>()
Gets the inclusive upper bound a value object declares.
public static TValue Maximum<TSelf, TValue>() where TSelf : IValueObjectMaximum<TValue>
Returns
TValue
The bound.
Type Parameters
TSelf
The value object.
TValue
Its underlying type.
Minimum<TSelf, TValue>()
Gets the inclusive lower bound a value object declares.
public static TValue Minimum<TSelf, TValue>() where TSelf : IValueObjectMinimum<TValue>
Returns
TValue
The bound.
Type Parameters
TSelf
The value object.
TValue
Its underlying type.
Text<TValue>(TValue)
Writes a bound as text, in the one invariant form a bound of its type is written in.
public static string Text<TValue>(TValue bound)
Parameters
bound TValue
The bound.
Returns
The text: digits for an integer or a decimal, the round-trip form of a real, the ISO 8601 form of a date or
a time, the constant form of a duration, and the character itself for a
Type Parameters
TValue
The type of the bound.
Remarks
It is the text the schema publishes, which the OpenAPI transformer and the type's own parser read back, and the text the message of a rejected value quotes.
A Z nor an offset:
the check compares clock readings, whatever their kind, and a