Skip to content

DelegatingConverter and CycleAvoidingMappingContext #101

@twallmey

Description

@twallmey

Hi,

I've defined a Mapper that should avoid cycles. For this reason I've just followed Mapstructs suggestion and invented the CycleAvoidingMappingContext. Doing so my current mapper looks like:

@Mapper(
    config = MapstructConfig.class
)
public interface DataModificationMapperV1Physical extends Converter<DataModificationV1, DataModification> {
  DataModification convert(DataModificationV1 from, @Context CycleAvoidingMappingContext context);

  @InheritInverseConfiguration
  @DelegatingConverter
  DataModificationV1 inverseConvert(DataModification from, @Context CycleAvoidingMappingContext context);
}

My problem obviously results from the additionally defined @DelegatingConverter because when compiling I get the following error:
Can only generate a delegating converter for methods with exactly one parameter and non-void return type.

Does anyone have an idea how to combine the CycleAvoidingMappingContext with @DelegatingConverter successfully?

Many thanks in advance,

Thorben

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions