BaseMapping<M>.namedMapper constructor

const BaseMapping<M>.namedMapper(
  1. String name
)

Creates a reference to a named mapper that will be injected at runtime.

Use this constructor when you want to provide a custom mapper through dependency injection. With this approach:

  1. You implement the mapper yourself
  2. Instantiate it outside of the generated code
  3. Provide it as a named parameter to initRdfMapper

The name will appear as a parameter name in the generated initRdfMapper function.

Example:

// In your class property
@RdfProperty(
  SchemaBook.price,
  literal: LiteralMapping.namedMapper('priceMapper')
)
final Price price;

// Later when initializing mappers:
final rdfMapper = initRdfMapper(
  priceMapper: myCustomPriceMapper
);

Implementation

const BaseMapping.namedMapper(String name)
    : _mapperName = name,
      _mapperType = null,
      _mapperInstance = null,
      _factoryName = null,
      _factoryConfigInstance = null;