Class Anonymizer.DateAnonymizer

Enclosing class:
Anonymizer

public class Anonymizer.DateAnonymizer extends Anonymizer.AbstractAnonymizer<Date,Anonymizer.DateAnonymizer>
Anonymizer used to obfuscate a fields containing date values. If the context doesn't contains the field assigned to this instance, all'the method of this class will not change the context.
  • Constructor Details

    • DateAnonymizer

      protected DateAnonymizer(String field)
  • Method Details

    • anonymize

      public Anonymizer.DateAnonymizer anonymize()
      Set a random Date (between DateUtils.DATE_MIN and DateUtils.DATE_MAX) as value of the field assigned to this instance.
      Returns:
      a reference of this object.
    • anonymize

      public Anonymizer.DateAnonymizer anonymize(long offset)
      Generate a random Date within the neighbourhood of the current field's value and set it as value of the field assigned to this instance.
      Parameters:
      offset - the size of the neighbourhood expressed as milliseconds. The random value wil be included between currentValueTimestamp - offset and currentValueTimestamp + offset
      Returns:
      a reference of this object.
      Throws:
      overit.geocall.asserts.AssertsException - if offset is negative.
    • anonymize

      public Anonymizer.DateAnonymizer anonymize(Date from, Date to)
      Generate a random Date between a given range and set it as value of the field assigned to this instance.
      Parameters:
      from - the lower bound date (included).
      to - the lower upper date (excluded).
      Returns:
      a reference of this object.
      Throws:
      overit.geocall.asserts.AssertsException - if lower bound date is greater equals than the upper bound ones.