Java EE 5 SDK

com.sun.appserv.management.util.misc
Class Formatter

java.lang.Object
  extended by com.sun.appserv.management.util.misc.Formatter
All Implemented Interfaces:
StringSource

public final class Formatter
extends Object
implements StringSource

Escapes/unescapes strings


Constructor Summary
Formatter(StringSource source)
           
 
Method Summary
 String format(String key, Object o1)
           
 String format(String key, Object[] objects)
          Format the objects into a String using the pattern specified by 'key'.
 String format(String key, Object o1, Object o2)
           
 String format(String key, Object o1, Object o2, Object o3)
           
 String format(String key, Object o1, Object o2, Object o3, Object o4)
           
 String getString(String id)
          Get the String referred to by 'id'
 String getString(String id, String defaultValue)
          Get the String referred to by 'id'.
 Object prepare(Object o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Formatter

public Formatter(StringSource source)
Method Detail

prepare

public Object prepare(Object o)

format

public String format(String key,
                     Object[] objects)
Format the objects into a String using the pattern specified by 'key'.

Parameters:
key - key used to look up the pattern
objects - array of objects to insert into the pattern

format

public String format(String key,
                     Object o1)

format

public String format(String key,
                     Object o1,
                     Object o2)

format

public String format(String key,
                     Object o1,
                     Object o2,
                     Object o3)

format

public String format(String key,
                     Object o1,
                     Object o2,
                     Object o3,
                     Object o4)

getString

public String getString(String id)
Description copied from interface: StringSource
Get the String referred to by 'id'

Specified by:
getString in interface StringSource
Parameters:
id - the id (key) for the String
Returns:
the String, or null if not found

getString

public String getString(String id,
                        String defaultValue)
Description copied from interface: StringSource
Get the String referred to by 'id'.

Specified by:
getString in interface StringSource
Parameters:
id - the id (key) for the String
defaultValue - the default value to be returned if string was not found
Returns:
the String, or defaultValue if not found

Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.