0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

メッセージレスポンスを作成するメソッドについて

Last updated at Posted at 2023-08-21

ここの、メッセージを呼びだすの部分をよく読む!!
https://github.com/Soba-Noodles/sakura/wiki/messages.properties%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E8%AA%AD%E3%81%BF%E8%BE%BC%E3%81%BF%E5%87%A6%E7%90%86%E3%81%AE%E5%AE%9F%E8%A3%85%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6

//Objectは、object型を指す。(メッセージにStringがくるか、Intがくるかわからないから)
...は、引数が複数入ったり、1つの場合があるから。
argsは引数のこと。 プレースホルダ。
動的に文字列が入ること。
private MessageResponse createErrorMessage(String errorCode, Object... args) {
String message = messageSource.messageSource().getMessage(errorCode, args, Locale.JAPAN);
return new MessageResponse(errorCode, message);
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?