Skip to content

Add lifecycle methods (after & before) #77

Description

@DenisBogatirov

It would be very helpful to have annotations for BeforeMapping & AfterMapping like the original mapstruct has.

Example usage:

class Source {}

class Target {
  Service _service;
  
  void setSevice(Service service) {
    _service = service;
  }
}

@Mapper()
abstract class SourceToTargetMapper {
  Service _service;

  SourceToTargetMapper(Service service) {
    _service = service;
  }

  Target fromSource(Source source);
  
  @AfterMapping()
  void afterMapping(Target target) {
    target.setService(_service);
  }
}

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions