public class SimpleTimeFormat extends Object implements TimeFormat
Duration of time| Modifier and Type | Field and Description |
|---|---|
static String |
QUANTITY |
static String |
SIGN |
static String |
UNIT |
| Constructor and Description |
|---|
SimpleTimeFormat() |
| Modifier and Type | Method and Description |
|---|---|
String |
decorate(Duration duration,
String time)
Decorate with past or future prefix/suffix (with rounding)
|
String |
decorateUnrounded(Duration duration,
String time)
Decorate with past or future prefix/suffix (without rounding)
|
String |
format(Duration duration)
Given a populated
Duration object. |
String |
formatUnrounded(Duration duration)
Given a populated
Duration object. |
protected String |
getGramaticallyCorrectName(Duration d,
boolean round) |
String |
getPattern() |
protected String |
getPattern(long quantity) |
protected long |
getQuantity(Duration duration,
boolean round) |
SimpleTimeFormat |
setFuturePluralName(String futurePluralName) |
SimpleTimeFormat |
setFuturePrefix(String futurePrefix) |
SimpleTimeFormat |
setFutureSingularName(String futureSingularName) |
SimpleTimeFormat |
setFutureSuffix(String futureSuffix) |
SimpleTimeFormat |
setPastPluralName(String pastPluralName) |
SimpleTimeFormat |
setPastPrefix(String pastPrefix) |
SimpleTimeFormat |
setPastSingularName(String pastSingularName) |
SimpleTimeFormat |
setPastSuffix(String pastSuffix) |
SimpleTimeFormat |
setPattern(String pattern) |
SimpleTimeFormat |
setPluralName(String pluralName) |
SimpleTimeFormat |
setRoundingTolerance(int roundingTolerance)
The percentage of the current
TimeUnit.getMillisPerUnit() for which the quantity may be rounded up by one. |
SimpleTimeFormat |
setSingularName(String name) |
String |
toString() |
public static final String SIGN
public static final String QUANTITY
public static final String UNIT
public String format(Duration duration)
TimeFormatDuration object. Apply formatting (with rounding) and output the result.format in interface TimeFormatpublic String formatUnrounded(Duration duration)
TimeFormatDuration object. Apply formatting (without rounding) and output the result.formatUnrounded in interface TimeFormatpublic String decorate(Duration duration, String time)
TimeFormatdecorate in interface TimeFormatduration - The original Duration instance from which the time string should be decorated.time - The formatted time string.public String decorateUnrounded(Duration duration, String time)
TimeFormatdecorateUnrounded in interface TimeFormatduration - The original Duration instance from which the time string should be decorated.time - The formatted time string.protected String getPattern(long quantity)
public String getPattern()
protected long getQuantity(Duration duration, boolean round)
public SimpleTimeFormat setPattern(String pattern)
public SimpleTimeFormat setFuturePrefix(String futurePrefix)
public SimpleTimeFormat setFutureSuffix(String futureSuffix)
public SimpleTimeFormat setPastPrefix(String pastPrefix)
public SimpleTimeFormat setPastSuffix(String pastSuffix)
public SimpleTimeFormat setRoundingTolerance(int roundingTolerance)
TimeUnit.getMillisPerUnit() for which the quantity may be rounded up by one.roundingTolerance - public SimpleTimeFormat setSingularName(String name)
public SimpleTimeFormat setPluralName(String pluralName)
public SimpleTimeFormat setFutureSingularName(String futureSingularName)
public SimpleTimeFormat setFuturePluralName(String futurePluralName)
public SimpleTimeFormat setPastSingularName(String pastSingularName)
public SimpleTimeFormat setPastPluralName(String pastPluralName)
Copyright © 2015 OCPsoft. All Rights Reserved.