We have many property files inside our java project. I don't understand the meaning of the integer values inside the curly braces.
Example:
validation.error=Input Validation Failed for field:[{0}]. Reason:[{1}]
They are for use with the MessageFormat
class. Something of the form {n}
, where n
is a number, is a placeholder for a dynamic value.
There are additional things you can add to the placeholder for formatting purposes; see the linked Javadocs above for more information.
They're placeholders for parameters. When used, two parameters would be passed to indicate the name of the field and the reason for failure.
The curly brackets are placeholders.
You can use placeholders in your messages and replace them with location-appropriate values at runtime based on the semantics of your user's language. For this you use the MessageFormat class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With