Skip to main content
Version: 0.3.x (0.3.0)

Interface IValueObjectVisitor<TResult>

Namespace: AdCodicem.ValueObjects.Metadata
Assembly: AdCodicem.ValueObjects.Abstractions.dll

Receives the type arguments of a value object that a caller knows only by its descriptor, so that the caller closes its own generic code over them at compile time.

public interface IValueObjectVisitor<out TResult>

Type Parameters​

TResult

What the visitor hands back: the adapter it built, a flag, a schema read off the type.

Remarks​

calls with the type arguments the descriptor was built with. An integration that finds value objects by creates its adapter there, new MyFormatter<TSelf, TValue>(), rather than closing it with and , which has no native code to run for a struct under native AOT.

Under native AOT, the compiler generates of each visitor the application creates for each value object a descriptor is built for in code: every value object the generator registers, and every value object registered by hand, a value object written by hand or a construction of a generic one. One the registry describes by reflection, the first time is asked for it because nothing registered it, has a visitor call too, which only the JIT can run.

A visitor needing context, a builder or a flag, holds it in fields. The calls happen at start-up, where creating a visitor per call costs nothing that matters.

Methods​

Visit<TSelf, TValue>()​

Receives the type arguments of the value object.

TResult Visit<TSelf, TValue>() where TSelf : struct, IValueObject<TSelf, TValue>

Returns​

TResult

What the visitor builds for the value object.

Type Parameters​

TSelf

The value object type.

TValue

Its underlying type.