net.sf.japaki.text
Class ClassFormat

java.lang.Object
  extended by java.text.Format
      extended by net.sf.japaki.text.AbstractFormat
          extended by net.sf.japaki.text.ClassFormat
All Implemented Interfaces:
Serializable, Cloneable

public class ClassFormat
extends AbstractFormat

A format to parse class names.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.japaki.text.AbstractFormat
AbstractFormat.DefaultField
 
Nested classes/interfaces inherited from class java.text.Format
Format.Field
 
Method Summary
 StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
          Appends the the canonical name of the given class to the string buffer.
static ClassFormat getInstance()
          Returns the singleton instance of this class.
 Object parseObject(String source, ParsePosition pos)
          Parses the sourcestring to the first non-java letter and tries to find the class for the parsed name.
 
Methods inherited from class net.sf.japaki.text.AbstractFormat
appendAndSetIndexes, getField, setField
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ClassFormat getInstance()
Returns the singleton instance of this class.

Returns:
the singleton instance of this class

parseObject

public Object parseObject(String source,
                          ParsePosition pos)
Parses the sourcestring to the first non-java letter and tries to find the class for the parsed name.

Specified by:
parseObject in class Format
Returns:
the class that has the parsed name
Throws:
NullPointerException - if source or pos is null.

format

public StringBuffer format(Object obj,
                           StringBuffer toAppendTo,
                           FieldPosition pos)
Appends the the canonical name of the given class to the string buffer.

Overrides:
format in class AbstractFormat
Parameters:
obj - class to be formatted
toAppendTo - where the text is to be appended
pos - ignored
Returns:
the string buffer passed in as toAppendTo, with formatted text appended
Throws:
NullPointerException - if obj is null.
IllegalArgumentException - if obj ist not a class.