LocalResourceMapping class

Configures mapping details for local resources (blank nodes) at the property level.

This class is used within the @RdfProperty annotation to customize how objects are serialized as blank nodes in RDF. Unlike class-level mappings configured with @RdfLocalResource, these mappings are scoped to the specific property where they are defined and are not registered globally.

In RDF, blank nodes represent anonymous resources that exist within the context of their parent resource, rather than having globally unique identifiers. This mapping is ideal for:

  • Composite objects or value objects
  • Nested structures where identity outside the parent context isn't needed
  • Objects that semantically don't make sense as standalone entities
  • Property-specific mapping behavior that differs from the class-level configuration

Important: Mappers configured through LocalResourceMapping are only used by the specific ResourceMapper whose property annotation references them. They are not registered in the global mapper registry and won't be available for use by other mappers or for direct lookup.

Example:

@RdfProperty(
  SchemaBook.chapter,
  localResource: LocalResourceMapping.namedMapper('customChapterMapper')
)
final Chapter firstChapter;

Without this override, the property would use the default mapper registered for the Chapter class, which might be configured with @RdfLocalResource at the class level. The key difference is that the class-level mapper is globally registered (unless registerGlobally: false is specified), while this property-level mapping is only used for this specific property.

Inheritance

Constructors

LocalResourceMapping.mapper(Type mapperType)
Creates a reference to a mapper that will be instantiated from the given type.
const
LocalResourceMapping.mapperInstance(LocalResourceMapper instance)
Creates a reference to a directly provided mapper instance for this local resource.
const
LocalResourceMapping.namedMapper(String name)
Creates a reference to a named mapper that will be injected at runtime.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
mapper MapperRef<LocalResourceMapper>?
Provides a MapperRef if a custom mapper is specified.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited