Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lifecycle methods (after & before) #77

Open
DenisBogatirov opened this issue Jan 24, 2023 · 1 comment
Open

Add lifecycle methods (after & before) #77

DenisBogatirov opened this issue Jan 24, 2023 · 1 comment

Comments

@DenisBogatirov
Copy link

DenisBogatirov commented Jan 24, 2023

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);
  }
}
@smotastic
Copy link
Owner

Hi, like the idea a lot, should also be relatively easy to implement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants