Class AbstractMask

java.lang.Object
com.aquima.interactions.framework.mask.impl.AbstractMask
All Implemented Interfaces:
IMask
Direct Known Subclasses:
AbstractSubstringMask, DatePattern, HexadecimalInteger, NumberPattern, OctalInteger, OrdinalNumber, RegularExpression, RomanInteger, SpelledBoolean, SpelledCurrency, SpelledDayOfWeek, SpelledDeltaDate, SpelledInteger, SpelledMonth, SpelledNumber

public abstract class AbstractMask extends Object implements IMask
Abstract class to simplify mask implementations. All pre processing validations are done by this abstract class. If the value passed in de mask context is unknown, then "" is returned.
Since:
6.0
Author:
Jon van Leuven
  • Constructor Details

    • AbstractMask

      public AbstractMask()
  • Method Details

    • getValidDataTypes

      protected abstract DataType[] getValidDataTypes()
      Should return the datatypes for which this mask can be applied.
      Returns:
      Array of datatypes.
    • applySingleValue

      protected abstract String applySingleValue(ISingleValue singleValue, IMaskContext context, ILanguage language) throws Exception
      This method is called when this mask is applied.
      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.
    • apply

      public IMultilingualText apply(IPrimitiveValue fieldValue, IMaskContext context) throws Exception
      Description copied from interface: IMask
      Apply the mask and return a multi lingual representation of an IPrimitiveValue.
      Specified by:
      apply in interface IMask
      Parameters:
      fieldValue - The value to be used by the mask (never null).
      context - The context in which the mask is called (never null).
      Returns:
      The applied mask result which should never be null.
      Throws:
      Exception - When an unexpected exception occurs and the mask cannot be applied.