org.apache.myfaces.trinidad.util
Class FastMessageFormat

java.lang.Object
  extended by org.apache.myfaces.trinidad.util.FastMessageFormat

public class FastMessageFormat
extends Object

The FastMessageFormat class is a greatly reduced version of the java.text.MessageFormat class. It's also much faster and much less expensive to create, which is especially valuable when it is created and thrown away many times - a common use case in web applications.

The only syntax supported by this class is simple index-based replacement, namely:

     some{1}text{0}here{2}andthere
 
Unlike MessageFormat, single quotes are NOT used for escaping. So, the following pattern could be used to include a left bracket:
     some{text{0}
 

Version:
$Name: $ ($Revision: adfrt/faces/adf-faces-api/src/main/java/oracle/adf/view/faces/util/FastMessageFormat.java#0 $) $Date: 10-nov-2005.19:08:37 $

Constructor Summary
FastMessageFormat(String formatString)
          Creates a FastMessageFormat based on the given format string.
 
Method Summary
 String format(Object[] source)
          This formatter will only replace patterns of the type "{[0-9]}" for which there is an associated token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastMessageFormat

public FastMessageFormat(String formatString)
Creates a FastMessageFormat based on the given format string.

Method Detail

format

public String format(Object[] source)
This formatter will only replace patterns of the type "{[0-9]}" for which there is an associated token. Any other use of '{}' will be interpreted as literal text. This aims to have the same behavior as TrFastMessageFormatUtils.format on the client.

Parameters:
source - an array of strings (tokens)


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.