Package org.approvej.scrub
Interface RelativeDateTimeReplacement
- All Superinterfaces:
BiFunction<String,,Integer, String> Replacement<String>
Replaces each match of the given dateTimePattern (as defined by
DateTimeFormatter) with a
relative description, like [10m ago], [in 2d 1h 3m 33s], [13d ago].
To avoid flaky results, the value is always rounded to a certain Duration (e.g. 1s).
This duration can be adjusted via roundedTo(Duration).
-
Method Summary
Modifier and TypeMethodDescriptiondateTimeFormatter(DateTimeFormatter dateTimeFormatter) Creates and returns a copy of this with the givenDateTimeFormatter.Rounds the relative date/time to the givenDuration.Methods inherited from interface java.util.function.BiFunction
andThenMethods inherited from interface org.approvej.scrub.Replacement
apply
-
Method Details
-
dateTimeFormatter
Creates and returns a copy of this with the givenDateTimeFormatter.- Parameters:
dateTimeFormatter- theDateTimeFormatterto be used- Returns:
- a copy of this using the given dateTimeFormatter
-
roundedTo
Rounds the relative date/time to the givenDuration.- Parameters:
roundingDuration- aDurationto round to- Returns:
- a copy of this using the given roundingDuration
-