Creating Messages with Argument Placeholders

Argument place holders are tokens which are included in the error message source text and are replaced by an argument at runtime.

Place holders are of the form %nc, where n is the argument number (of 1 or more), and c is a single character denoting the argument type as follows:

For example, the source message:

"The first name is %1s and the surname is %2s"

would be displayed as:

"The first name is John and the surname is Smith"

The fact that the place holders are numbered means that they can appear in the message in any order. For example, the source message:

"The second name is %2s and the first name is %1s"

would be displayed as:

"The second name is Smith and the first name is John"

The exception would be constructed and thrown as shown in Creating Messages with Argument Placeholders.

Figure 1. Exception message with argument placeholders
curam.util.exception.AppException e = new
          AppExeption(EXAMPLE.ID_EXAMPLE_MESSAGE);
e.arg(Person.FirstName);
e.arg(Person.Surname);
throw e;