net.sf.fikin.pojostate.format
Class DurationFormat
java.lang.Object
java.text.Format
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:
- wk - refers to the week in the year
- dayWeek - refers to the day in the week
- dayHour - refers to the hour in the day (24h)
- minHour - refers to the minute in the hour
- secMin - refers to the seconds in the minutes
- msSec - refers to the milliseconds in the second
- days - refers to the total number of days
- hours - refers to the total number of hours
- minutes - refers to the total number of minutes
- secs - refers to the total number of seconds
- ms - refers to the total number of milliseconds
created on Jul 27, 2005
- Since:
- Version:
- $Revision: 1.2 $
- Author:
- niki
- See Also:
- Serialized Form
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 |
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 |
fields
protected static final java.lang.String[] fields
- list with recognized pattern keywords
DurationFormat
public DurationFormat(java.lang.String pattern)
DurationFormat
public DurationFormat(java.lang.String pattern,
java.util.Locale locale)
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.