git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@639889 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Matthew Jason Benson 2008-03-21 22:18:33 +00:00
parent 08e004c8d2
commit 8097ca7d3b
1 changed files with 2 additions and 3 deletions

View File

@ -116,14 +116,13 @@ by format type) to <code>ExtendedMessageFormat</code>:
new ExtendedMessageFormat("EIN: {0,ein}", Collections.singletonMap(EINFormatFactory.EIN_FORMAT, new EINFormatFactory())); new ExtendedMessageFormat("EIN: {0,ein}", Collections.singletonMap(EINFormatFactory.EIN_FORMAT, new EINFormatFactory()));
</code></pre> </code></pre>
As expected, this will render a String EIN "AA-9999" as: <code>"EIN: AA-9999"</code>. As expected, this will render a String EIN "AA-9999" as: <code>"EIN: AA-9999"</code>.
<br /> <br /> <br />
If we wanted to trigger the EIN masking code, we could trigger that in the format pattern: If we wanted to trigger the EIN masking code, we could trigger that in the format pattern:
<pre><code> <pre><code>
new ExtendedMessageFormat("EIN: {0,ein,#}", Collections.singletonMap(EINFormatFactory.EIN_FORMAT, new EINFormatFactory())); new ExtendedMessageFormat("EIN: {0,ein,#}", Collections.singletonMap(EINFormatFactory.EIN_FORMAT, new EINFormatFactory()));
</code></pre> </code></pre>
This should render "AA-9999" as: <code>"EIN: AA-####"</code>. This should render "AA-9999" as: <code>"EIN: AA-####"</code>.
</p> <br /> <br />
<p>
You can also use <code>ExtendedMessageFormat</code> to override any or all of the built-in You can also use <code>ExtendedMessageFormat</code> to override any or all of the built-in
formats supported by <code>java.text.MessageFormat</code>. Finally, note that because formats supported by <code>java.text.MessageFormat</code>. Finally, note that because
<code>ExtendedMessageFormat</code> extends <code>MessageFormat</code> it should work in most <code>ExtendedMessageFormat</code> extends <code>MessageFormat</code> it should work in most