So again, I am a bit confused about some notes that i'am getting from my reviewer. I have some kind of utils, to print/prepare log messages. Yea, maybe I am a bit fanatic java 8 lambda guy but I think it is still under control. :)
So its looks like that [I hide 'sensitive' data]
public class ExceptionUtils {
private static final BiFunction<String, String, String> CUSTOM_EXCEPTION_MESSAGE_FORMAT =
(typeOfError, typeOfEndpoint) -> "[XXX] " + typeOfError + " Error during process bulk " + typeOfEndpoint + " events. "
+ "Event "
+ "occurrences time: %d "
+ "event retry count: %d, "
+ "session: %s";
public static String validationMessageException(String endpoint, long timestamp, int retryCount, String sessionToken) {
return String.format(CUSTOM_EXCEPTION_MESSAGE_FORMAT.apply("Validation", endpoint), timestamp, retryCount, sessionToken);
}
public static String unknownMessageException(String endpoint, long timestamp, int retryCount, String sessionToken) {
return String.format(CUSTOM_EXCEPTION_MESSAGE_FORMAT.apply("Unknown", endpoint), timestamp, retryCount, sessionToken);
}
}
static String foo(String s1, String s2) {...}
in places where aBiFunction<String, String, String>
is expected. \$\endgroup\$