net.sf.fikin.pojostate.format
Class DurationFormat

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

public class DurationFormat
extends java.text.Format

Duration date format

Expects java.lang.Long or java.util.Date objects and applies formating in format of time duration.

Formatting patterns are same as java.text.MessageFormat where instead of numeric field position it expects on of following predefined constants:

created on Jul 27, 2005

Since:
Version:
$Revision: 1.2 $
Author:
niki
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
java.text.Format.Field
 
Field Summary
protected static java.lang.String[] fields
          list with recognized pattern keywords
 
Constructor Summary
DurationFormat(java.lang.String pattern)
           
DurationFormat(java.lang.String pattern, java.util.Locale locale)
           
 
Method Summary
 java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
           
 java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
          not supported
protected static java.lang.String parsePattern(java.lang.String pattern)
          replace field as named in the pattern with index positions suitable for MessageFormat pattern.
 
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
 

Field Detail

fields

protected static final java.lang.String[] fields
list with recognized pattern keywords

Constructor Detail

DurationFormat

public DurationFormat(java.lang.String pattern)

DurationFormat

public DurationFormat(java.lang.String pattern,
                      java.util.Locale locale)
Method Detail

parsePattern

protected static java.lang.String parsePattern(java.lang.String pattern)
replace field as named in the pattern with index positions suitable for MessageFormat pattern.

Parameters:
pattern -
Returns:
pattern with replaced field names

format

public java.lang.StringBuffer format(java.lang.Object obj,
                                     java.lang.StringBuffer toAppendTo,
                                     java.text.FieldPosition pos)
Specified by:
format in class java.text.Format

parseObject

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

Specified by:
parseObject in class java.text.Format


Copyright © 2005 Nikolay Fiykov. All Rights Reserved.