简体   繁体   中英

MESSAGE_FORMAT with {x.y}

How can I add the string value of the property (from a User-instance) within the message format?

// I want to access a property from the user and put it into the message
@Message(value = "the user: {user.id} - {user.name}", format = Message.Format.MESSAGE_FORMAT)
void test(User user);

How can I do that?

Expressions like that are not currently supported. You'd need to do it manually with something like:

@Message(value = "the user: {0} - {1}", format = Message.Format.MESSAGE_FORMAT)
void test(String id, String name);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM