net.sf.fikin.pojostate.format
Class FixedStringFormat

java.lang.Object
  extended by java.text.Format
      extended by net.sf.fikin.pojostate.format.FixedStringFormat
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class FixedStringFormat
extends java.text.Format

Prints a fixed string instead of actually formatting the input object.

This is useful when you want to print an error but you can't throw an exception. created on Jul 6, 2005

Since:
Version:
$Revision: 1.1 $
Author:
fiykov
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
java.text.Format.Field
 
Constructor Summary
FixedStringFormat(java.lang.String message)
          instantiate this formatter with given message.
FixedStringFormat(java.lang.String message, java.lang.Throwable err)
          instantiate this formatter with given message.
 
Method Summary
 java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
          It does not format but rather prints out the given at construction time message.
 java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
          not supported
 
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
 

Constructor Detail

FixedStringFormat

public FixedStringFormat(java.lang.String message)
instantiate this formatter with given message.

Parameters:
message - to be printed

FixedStringFormat

public FixedStringFormat(java.lang.String message,
                         java.lang.Throwable err)
instantiate this formatter with given message.

Parameters:
message - to be printed
err - to be printed
Method Detail

parseObject

public java.lang.Object parseObject(java.lang.String source,
                                    java.text.ParsePosition pos)
not supported

Specified by:
parseObject in class java.text.Format
Parameters:
source -
pos -
Returns:
null

format

public java.lang.StringBuffer format(java.lang.Object obj,
                                     java.lang.StringBuffer toAppendTo,
                                     java.text.FieldPosition pos)
It does not format but rather prints out the given at construction time message.

Specified by:
format in class java.text.Format
Parameters:
obj - has to be java.lang.Boolean
toAppendTo - to append the string representation of obj
pos - is irrelevant in this method
Returns:
updated toAppendTo


Copyright © 2005 Nikolay Fiykov. All Rights Reserved.