Skip to content

DelegatingConverter and CycleAvoidingMappingContext #101

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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