LocalResourceMapping.namedMapper constructor
const
LocalResourceMapping.namedMapper(
- String name
Creates a reference to a named mapper that will be injected at runtime.
Use this constructor when you want to provide your own custom
LocalResourceMapper implementation rather than using the automatic generator.
The mapper you provide will determine how instances of the class are mapped to
RDF subjects. When using this approach, you must:
- Implement the mapper yourself
- Instantiate the mapper (outside of the generated code)
- Provide the mapper instance as a named parameter to
initRdfMapper
The name will correspond to a parameter in the generated initRdfMapper function,
but the mapper will not be registered globally in the RdfMapper instance
but only used for the Resource Mapper whose property is annotated with this mapping.
Example:
@RdfGlobalResource.namedMapper('customBookMapper')
class Book {
// ...
}
// You must implement the mapper:
class MyBookMapper implements GlobalResourceMapper<Book> {
// Your implementation...
}
// In initialization code:
final bookMapper = MyBookMapper();
final rdfMapper = initRdfMapper(customBookMapper: bookMapper);
Implementation
const LocalResourceMapping.namedMapper(String name) : super.namedMapper(name);