Java String parameter needed - object given

Viewed 30

I am learning Java and I hope someone can help me here with the following problem.

Some information first:

  • Keycloak update v16.1.0 to v19.0.1
  • quarkus should not be used at the moment
  • interface "EmailSenderProvider" was implemented and worked with v16.1.0
  • EmailSenderProvider in v19.0.1 has two methods
    • public void send (default) -> parameters: UserModel user, 3x Strings
    • public void send -> parameters: 4x Strings

The problem now: v16.1.0 had only one method (UserModel user, 3x Strings). That is not working anymore, because I have to implement the method with 4x Strings. I should not import a method with an empty body.

Code example:

  @Override
  public void send(final Map<String, String> config, final UserModel user, final String subject, final String textBody, final String htmlBody)
      throws EmailException {

    try {
      final String address = retrieveEmailAddress(user);

Method "retrieveEmailAddress" take just an object and save the emailaddress into a String:

  protected String retrieveEmailAddress(final UserModel user) {
    return user.getEmail();
  }

I have no more ideas how to get the emailaddress out of an object into a String parameter...

Thanks in advance.

Have a good day

0 Answers
Related