RdfLocalResource.mapperInstance constructor

const RdfLocalResource.mapperInstance(
  1. LocalResourceMapper instance, {
  2. MapperDirection direction = MapperDirection.both,
})

Creates a reference to a directly provided mapper instance for this local resource.

This allows you to supply a pre-existing instance of a LocalResourceMapper for this class. Useful when your mapper requires constructor parameters or complex setup that cannot be handled by simple instantiation.

Example:

// Create a pre-configured mapper with const constructor:
const chapterMapper = CustomChapterMapper(
  validation: strictValidation,
  options: chapterOptions,
);

@RdfLocalResource.mapperInstance(chapterMapper)
class Chapter {
  // ...
}

Note: Since annotations in Dart must be evaluated at compile-time, the mapper instance must be a compile-time constant.

Implementation

const RdfLocalResource.mapperInstance(LocalResourceMapper instance,
    {super.direction})
    : classIri = null,
      super.mapperInstance(instance);