File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
hivemq-edge/src/main/java/com/hivemq/common/i18n Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1818
1919import org .jetbrains .annotations .NotNull ;
2020
21+ import java .util .Map ;
22+
2123public interface I18nError {
24+ @ NotNull String get ();
25+
26+ @ NotNull String get (final @ NotNull Map <String , Object > map );
27+
2228 @ NotNull String getKey ();
2329
2430 @ NotNull String getName ();
Original file line number Diff line number Diff line change @@ -45,21 +45,26 @@ public enum I18nHttpError implements I18nError {
4545 private static final @ NotNull String RESOURCE_NAME_SUFFIX = ".properties" ;
4646 private static final I18nErrorTemplate TEMPLATE =
4747 new I18nErrorTemplate (locale -> RESOURCE_NAME_PREFIX + locale + RESOURCE_NAME_SUFFIX );
48+
49+ private final @ NotNull String key ;
4850
4951 I18nHttpError () {
52+ key = name ().toLowerCase ().replace ("_" , "." );
5053 }
5154
55+ @ Override
5256 public @ NotNull String get () {
5357 return get (Map .of ());
5458 }
5559
60+ @ Override
5661 public @ NotNull String get (final @ NotNull Map <String , Object > map ) {
5762 return TEMPLATE .get (this , map );
5863 }
5964
6065 @ Override
6166 public @ NotNull String getKey () {
62- return name (). toLowerCase (). replace ( "_" , "." ) ;
67+ return key ;
6368 }
6469
6570 @ Override
You can’t perform that action at this time.
0 commit comments