What do curly brackets inside java properties file mean?

We have many properties files inside our java project. I do not understand the meaning of integer values ​​inside curly braces.
Example:
validation.error = Input validation Failed to execute field: [{0}]. Reason: [{1}]

+4
source share
3 answers

They are intended for use with the class MessageFormat. Something like the form {n}where nis the number is a placeholder for a dynamic value.

There are additional things you can add to the placeholder for formatting purposes; see related javadocs above for more information.

+3

. .

+2

Curly braces are placeholders.

You can use placeholders in your posts and replace them with appropriate location values ​​at run time based on the semantics of your custom language. For this, you use the MessageFormat class.

+1
source

All Articles