you can not do "import x as y;" in Java.

What you CAN do is to extend the class, or write a wrapper class for it, and import that one instead.

import com.backend.mypackage.a.b.c.UserDto;

public class ImportAlias {
    static class UserDtoAlias extends com.backend.mypackage.a.b.c.d.UserDto {
    }

    public static void main(String[] args) {
        UserDto userBackend = new UserDto();
        UserDtoAlias userService = new UserDtoAlias();

        mapper(userBackend, userService);
    }

    private static void mapper(UserDto userBackend, UserDtoAlias userService) {
        // ...
    }
}

 

相关文章:

  • 2021-11-14
  • 2021-10-24
  • 2022-12-23
  • 2022-01-18
  • 2021-10-15
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-30
  • 2021-07-24
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-10-29
相关资源
相似解决方案