I am working on code refactoring, following the document Deprecated APIs | Adobe Experience Manager.
The documentation states that org.apache.commons.lang.text is deprecated and instead, Commons Lang 3 should be used.
Code Snippet
import org.apache.commons.lang.text.StrLookup;
import org.apache.commons.mail.Email;
import com.day.cq.commons.mail.MailTemplate;
Email email = mailTemplate.getEmail(StrLookup.mapLookup(emailParams), HtmlEmail.class);
Here emailParams is a map of key and value both as string. "Map<String, String> emailParams".
This getEmail method needs "StrLookup" which is only returned by "mapLookup" method provided by "org.apache.commons.lang.text.StrLookup".
The "mapLookup" method provided by "org.apache.commons.lang3.text.StrLookup" returns StrLookup<V>. https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/text/StrLookup.html
and is not suitable for getEmail method.
I looked into org.apache.commons.text.lookup.StringLookupFactory as well but there is no method which just returns StrLookup.
Is there any alternative ? What can be used here ? Please suggest.