org.eclipse.swtbot.swt.finder.utils
Class MessageFormat

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.utils.MessageFormat

public class MessageFormat
extends Object

Message formatter to optimize logging performance. The cost of logging is mostly in the string concatenation and parameter evaluation of arguments. Log4j logs the object by invoking toString() on the object being logged. This class performs lazy evaluation of the message, only when toString() is invoked, which happens at the time of logging.

Note: This class uses a ThreadLocal cache instead of a single cache, since the cache would then need to be synchronized since multiple threads would access it.

Version:
$Id$
Author:
Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>

Method Summary
static MessageFormat format(String s, Object... args)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

format

public static MessageFormat format(String s,
                                   Object... args)

toString

public String toString()
Overrides:
toString in class Object