public class PrettyTimeFormat extends Format implements FormatProvider
Format implementation for PrettyTime.Format.Field| Constructor and Description |
|---|
PrettyTimeFormat() |
PrettyTimeFormat(Locale locale) |
| Modifier and Type | Method and Description |
|---|---|
org.ocpsoft.prettytime.Duration |
approximateDuration(Date then) |
List<org.ocpsoft.prettytime.Duration> |
calculatePreciseDuration(Date then) |
List<org.ocpsoft.prettytime.TimeUnit> |
clearUnits() |
static FormatFactory |
factory() |
String |
format(Date ref,
Date then)
Convenience format method.
|
String |
format(Date ref,
Date then,
long precision)
Convenience format method for precise durations.
|
String |
format(org.ocpsoft.prettytime.Duration duration) |
String |
format(List<org.ocpsoft.prettytime.Duration> durations) |
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos) |
String |
formatUnrounded(Date then) |
String |
formatUnrounded(org.ocpsoft.prettytime.Duration duration) |
FormatFactory |
getFactory()
Gets the format factory.
|
org.ocpsoft.prettytime.TimeFormat |
getFormat(org.ocpsoft.prettytime.TimeUnit unit) |
String |
getFormatName()
Gets the format name that will be registered.
|
org.ocpsoft.prettytime.PrettyTime |
getPrettyTime()
Gets the underlying
PrettyTime instance. |
List<org.ocpsoft.prettytime.TimeUnit> |
getUnits() |
Object |
parseObject(String source,
ParsePosition pos) |
org.ocpsoft.prettytime.PrettyTime |
registerUnit(org.ocpsoft.prettytime.TimeUnit unit,
org.ocpsoft.prettytime.TimeFormat format) |
clone, format, formatToCharacterIterator, parseObjectpublic PrettyTimeFormat()
public PrettyTimeFormat(Locale locale)
public static FormatFactory factory()
public org.ocpsoft.prettytime.Duration approximateDuration(Date then)
public List<org.ocpsoft.prettytime.Duration> calculatePreciseDuration(Date then)
public List<org.ocpsoft.prettytime.TimeUnit> clearUnits()
public String format(Date ref, Date then)
ref - The date of reference.then - The future date.public String format(Date ref, Date then, long precision)
ref - The date of reference.then - The future date.precision - The precision to retain in milliseconds.public String format(org.ocpsoft.prettytime.Duration duration)
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
public String formatUnrounded(org.ocpsoft.prettytime.Duration duration)
public FormatFactory getFactory()
FormatProvidergetFactory in interface FormatProviderFormatFactory instancepublic org.ocpsoft.prettytime.TimeFormat getFormat(org.ocpsoft.prettytime.TimeUnit unit)
public String getFormatName()
FormatProvidergetFormatName in interface FormatProviderpublic org.ocpsoft.prettytime.PrettyTime getPrettyTime()
PrettyTime instance.PrettyTime instance.public List<org.ocpsoft.prettytime.TimeUnit> getUnits()
public Object parseObject(String source, ParsePosition pos)
parseObject in class Formatpublic org.ocpsoft.prettytime.PrettyTime registerUnit(org.ocpsoft.prettytime.TimeUnit unit,
org.ocpsoft.prettytime.TimeFormat format)
Copyright © 2015. All Rights Reserved.