GlobalResourceMapping class

Configures mapping details for global resources (resources with IRIs) at the property level.

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

In RDF, global resources represent entities with their own unique identifiers (IRIs). This mapping is ideal for:

  • Objects that need their own identity across multiple contexts
  • Resources that might be referenced from multiple places
  • Entities with global identifiers that can be linked to externally
  • Property-specific mapping behavior that differs from the class-level configuration

Important: Mappers configured through GlobalResourceMapping 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.

Use this class when you need to:

  • Override the default mapper for a property's type
  • Apply specialized mapping logic for a specific relationship
  • Use a different mapping strategy for the same type in different contexts

Example:

@RdfProperty(
  SchemaBook.publisher,
  globalResource: GlobalResourceMapping.namedMapper('specialPublisherMapper')
)
final Publisher publisher;

Without this override, the property would use the default mapper registered for the Publisher class, which might be configured with @RdfGlobalResource 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

GlobalResourceMapping.mapper(Type mapperType)
Creates a reference to a mapper that will be instantiated from the given type.
const
GlobalResourceMapping.mapperInstance(GlobalResourceMapper instance)
Creates a reference to a directly provided mapper instance.
const
GlobalResourceMapping.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<GlobalResourceMapper>?
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