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

Using interceptor inside mapper that declared as a abstract class #92

Closed
vakoroteev opened this issue May 10, 2016 · 1 comment
Closed
Labels
Milestone

Comments

@vakoroteev
Copy link

I try to use interceptor declaration inside abstract mapper. But in generated class this method has called through variable customMapper(MyMapperName) that not declared. For me expected behavior is calling interceptor methods through this reference if there isn't another customMapper.

Below is example of my use case. May be I'm doing something wrong...

@Mapper(withIgnoreMissing = IgnoreMissing.ALL)
public abstract class AddressMapper {
    public abstract AddressDTO convert(Address address);

    public void interceptor(Address addressDTO, AddressDTO address) {
        System.out.println("bean to dto");
    }
}


public final class AddressMapperSelmaGeneratedClass extends AddressMapper {

  /**
   * Mapping method overridden by Selma
   */
  @Override
  public final com.tcs.mortgage.rest.dto.questionary.AddressDTO convert(com.tcs.mortgage.model.mortgage.questionary.Address in) {
    com.tcs.mortgage.rest.dto.questionary.AddressDTO out = null;
    if (in != null) {
      out = new com.tcs.mortgage.rest.dto.questionary.AddressDTO();
      //... some setters
      out.setStreet(in.getStreet());
    }
    customMapperAddressMapper.interceptor(in,out); // <--  customMapperAddressMapper  variable that is not declared. Compile error
    return out;
  }

  /**
   * Single constructor
   */
  public AddressMapperSelmaGeneratedClass() {
  }

}
@slemesle
Copy link

Hi thanks for the issue, you are right the call should be this instead of custom mapper.

slemesle added a commit that referenced this issue May 11, 2016
#92 Using interceptor inside mapper that declared as a abstract class
@slemesle slemesle added the bug label Jul 15, 2016
@slemesle slemesle added this to the 0.15 milestone Jul 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants