Class RelativeDateReplacement

java.lang.Object
org.approvej.scrub.RelativeDateReplacement
All Implemented Interfaces:
BiFunction<String,Integer,String>, Replacement

public class RelativeDateReplacement extends Object implements Replacement
Replaces each match of the given dateTimePattern (as defined by DateTimeFormatter) with a relative description, like [today], [yesterday], [13 days from now].
  • Method Details

    • apply

      public String apply(String match, Integer count)
      Description copied from interface: Replacement
      Will return a replacement for the given match and count.

      The count will be the same for equal matches. E.g. if all vowels ([aeiou]) should be replaced in the text Hello there, this will be applied four times:

      1. He
        apply("e", 1),
      2. Hello
        apply("o", 2),
      3. Hello the
        apply("e", 1),
      4. Hello there
        apply("e", 1)
      Specified by:
      apply in interface BiFunction<String,Integer,String>
      Specified by:
      apply in interface Replacement
      Parameters:
      match - the found string that will be replaced
      count - the number of the distinct match
      Returns:
      the replacement