Class Anonymizer.TimeAnonymizer

Enclosing class:
Anonymizer

public class Anonymizer.TimeAnonymizer extends Anonymizer.AbstractAnonymizer<Date,Anonymizer.TimeAnonymizer>
Anonymizer used to obfuscate a fields containing time 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

    • TimeAnonymizer

      protected TimeAnonymizer(String field)
  • Method Details

    • anonymize

      public Anonymizer.TimeAnonymizer anonymize()
      Set a random Time (between DateUtils.TIME_MIN and DateUtils.TIME_MAX) as value of the field assigned to this instance.
      Returns:
      a reference of this object.
    • anonymize

      public Anonymizer.TimeAnonymizer anonymize(long offset)
      Generate a random time 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.TimeAnonymizer 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.