Minor refactoring after recent commits

See gh-29384
This commit is contained in:
rstoyanchev
2022-11-01 13:56:40 +00:00
parent e71057dca9
commit 921eeadff4
4 changed files with 16 additions and 17 deletions

View File

@@ -100,14 +100,15 @@ public interface ErrorResponse {
* <p>By default this is initialized via
* {@link #getDefaultDetailMessageCode(Class, String)}.
*/
default String getTitleCode() {
default String getTitleMessageCode() {
return getDefaultTitleMessageCode(getClass());
}
/**
* Resolve the {@link #getDetailMessageCode() detailMessageCode} and the
* {@link #getTitleCode() titleCode} through the given {@link MessageSource},
* and if found, update the "detail" and "title!" fields respectively.
* {@link #getTitleMessageCode() titleCode} through the given
* {@link MessageSource}, and if found, update the "detail" and "title!"
* fields respectively.
* @param messageSource the {@code MessageSource} to use for the lookup
* @param locale the {@code Locale} to use for the lookup
*/
@@ -118,7 +119,7 @@ public interface ErrorResponse {
if (detail != null) {
getBody().setDetail(detail);
}
String title = messageSource.getMessage(getTitleCode(), null, null, locale);
String title = messageSource.getMessage(getTitleMessageCode(), null, null, locale);
if (title != null) {
getBody().setTitle(title);
}