public class HumanizeTime extends Object implements com.vityuk.ginger.LocaleResolver
| Constructor and Description |
|---|
HumanizeTime()
Constructs an instance of
HumanizeTime relative to the time of construction. |
HumanizeTime(Temporal temporal)
Constructs an instance of
HumanizeTime. |
HumanizeTime(Temporal temporal,
Locale locale)
Constructs an instance of
HumanizeTime with a specified Locale. |
HumanizeTime(Temporal temporal,
com.vityuk.ginger.LocaleResolver localeResolver)
Constructs an instance of
HumanizeTime with a LocaleResolver which may be expressed by a lambda,
e.g. |
| Modifier and Type | Method and Description |
|---|---|
String |
from(Temporal temporal)
Returns a humanized message for the relative time between
temporal and the reference temporal, i.e. |
String |
fromNow()
Returns a humanized message for the relative time between now and the reference temporal, i.e.
|
static String |
fromNow(Temporal temporal)
Returns a humanized message for the relative time between now and
temporal. |
static String |
fromNow(Temporal temporal,
Locale locale)
Returns a humanized message for the relative time between now and
temporal. |
static String |
fromNow(Temporal temporal,
com.vityuk.ginger.LocaleResolver localeResolver)
Returns a humanized message for the relative time between now and
temporal. |
Locale |
getLocale() |
public HumanizeTime()
HumanizeTime relative to the time of construction.public HumanizeTime(Temporal temporal)
HumanizeTime.temporal - the reference timepublic HumanizeTime(Temporal temporal, Locale locale)
HumanizeTime with a specified Locale.temporal - the reference timelocale - the locale used to localize the messagepublic HumanizeTime(Temporal temporal, com.vityuk.ginger.LocaleResolver localeResolver)
HumanizeTime with a LocaleResolver which may be expressed by a lambda,
e.g. new HumanizeTime(temporal, () -> Locale.ENGLISH.temporal - the reference timelocaleResolver - the resolver for the locale used to localize the messagepublic static String fromNow(Temporal temporal)
temporal.temporal - the reference timepublic static String fromNow(Temporal temporal, Locale locale)
temporal.temporal - the reference timelocale - the locale used to localize the messagepublic static String fromNow(Temporal temporal, com.vityuk.ginger.LocaleResolver localeResolver)
temporal.temporal - the reference timelocaleResolver - the resolver for the locale used to localize the messagepublic String fromNow()
HumanizeTime).public String from(Temporal temporal)
temporal and the reference temporal, i.e. the
one used to construct this instance of HumanizeTime.temporal - the reference timepublic Locale getLocale()
getLocale in interface com.vityuk.ginger.LocaleResolverCopyright © 2017. All rights reserved.