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

Comments

Projects
None yet
2 participants
@vakoroteev

vakoroteev commented May 10, 2016

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

This comment has been minimized.

Show comment
Hide comment
@slemesle

slemesle May 11, 2016

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

slemesle commented May 11, 2016

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

Merge pull request #93 from vakoroteev/master
#92 Using interceptor inside mapper that declared as a abstract class

@vakoroteev vakoroteev closed this May 11, 2016

@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