BaseMapping<M>.mapper constructor

const BaseMapping<M>.mapper(
  1. Type mapperType
)

Creates a reference to a mapper that will be instantiated from the given type.

The code generator will create an instance of mapperType using its default constructor to handle mapping for this type.

Use this approach when your mapper has a default constructor and doesn't require additional configuration parameters.

Example:

@RdfProperty(
  SchemaBook.price,
  literal: LiteralMapping.mapper(StandardPriceMapper)
)
final Price price;

// The mapper class must be accessible to the generator:
class StandardPriceMapper implements LiteralTermMapper<Price> {
  // Implementation...
}

Implementation

const BaseMapping.mapper(Type mapperType)
    : _mapperName = null,
      _mapperType = mapperType,
      _mapperInstance = null,
      _factoryName = null,
      _factoryConfigInstance = null;