Class SpelledDeltaDate

java.lang.Object
com.aquima.interactions.framework.mask.impl.AbstractMask
com.aquima.interactions.framework.mask.impl.SpelledDeltaDate
All Implemented Interfaces:
IMask

public class SpelledDeltaDate extends AbstractMask

This mask returns a user friendly representation of the delta of a date with today.

Example when applied to a date:

  • 1 day ago
  • 6 months ago
  • in 3 days
  • today
  • 1 month and 17 days ago
  • 1 year, 2 months and 26 days ago
  • in 1 year, 2 months and 26 days

Example when applied to a datetime:

  • 1 second ago
  • 6 minutes ago
  • in 3 hours
  • now
  • 80 hours, 59 minutes and 37 seconds ago
Since:
7.1
Author:
Jon van Leuven
  • Constructor Details

    • SpelledDeltaDate

      public SpelledDeltaDate()
  • Method Details

    • applySingleValue

      protected String applySingleValue(ISingleValue singleValue, IMaskContext context, ILanguage language) throws Exception
      Description copied from class: AbstractMask
      This method is called when this mask is applied.
      Specified by:
      applySingleValue in class AbstractMask
      Parameters:
      singleValue - The value, never null and never unknown.
      context - Mask context
      language - the language
      Returns:
      The applied mask result.
      Throws:
      Exception - When something went wrong.
    • getNow

      protected DateTimeValue getNow()
      This method may be overridden when an application uses "time traveling".
      Returns:
      The date time representing now.
    • getValidDataTypes

      protected DataType[] getValidDataTypes()
      Description copied from class: AbstractMask
      Should return the datatypes for which this mask can be applied.
      Specified by:
      getValidDataTypes in class AbstractMask
      Returns:
      Array of datatypes.