Interface FieldMasker

All Known Implementing Classes:
FieldNameBasedFieldMasker, PathBasedFieldMasker
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface FieldMasker
Masks JSON fields within a JSON stream. Invoked by MaskingJsonGenerator after a field name is written (but before the field's value is known) to determine if the field's value should be masked.

Comparison with ValueMasker

  • Method Summary

    Modifier and Type
    Method
    Description
    If the field at the JSON stream context's current path should be masked, then returns the masked value to write as the field's value.
  • Method Details

    • mask

      Object mask(JsonStreamContext context)
      If the field at the JSON stream context's current path should be masked, then returns the masked value to write as the field's value. The MaskingJsonGenerator will write the returned masked value as the field's value (instead of the original field's value).

      If the JSON stream context's current path should NOT be masked, returns null.

      Parameters:
      context - the current JSON stream context, which can be used to determine the path within the JSON output.
      Returns:
      A non-null masked value to write if the current field should be masked. Otherwise null if the current field should not be masked. To write a JSON null value as the masked value, return NullNode.instance. To write "****", the return MaskingJsonGenerator.MASK