Java

I had a problem where I was required to use java.text.MessageFormat, but this formatter doesn’t allow for formatting boolean values. However, it is possible to add new formatters to an existing MessageFormat instance, if they are instances of java.text.ChoiceFormat:

String actualPattern = "{0}";
MessageFormat mf = new MessageFormat(actualPattern);
mf.setFormat(0, new MyFormatter());
// proceed with formatting

You can see my custom formatter, which returns “/” on true, “” on false, directly on SVN.