Class JsonMaskingConfig.Builder

java.lang.Object
dev.blaauwendraad.masker.json.config.JsonMaskingConfig.Builder
Enclosing class:
JsonMaskingConfig

public static class JsonMaskingConfig.Builder extends Object
Builder to create JsonMaskingConfig instances using the builder pattern.
  • Constructor Details

  • Method Details

    • maskNumericValuesWith

      public JsonMaskingConfig.Builder maskNumericValuesWith(int maskNumericValuesWith)
      Specifies the number with which numeric values should be replaced. -1 denotes number masking is disabled.

      In case maskNumericValuesWith is set to 0, obfuscationLength must be set to either 0 or 1 in which both case numbers are replaced with a single 0. This is in order to preserve valid JSON.

      Default value: -1 (numeric values are not masked)

      Parameters:
      maskNumericValuesWith - the number to mask numeric JSON properties with
      Returns:
      the builder instance
    • obfuscationLength

      public JsonMaskingConfig.Builder obfuscationLength(int obfuscationLength)
      Parameters:
      obfuscationLength - specifies the fixed length of the mask when target value lengths is obfuscated. E.g. masking any string value with obfuscation length 2 results in "**".

      In case obfuscationLength is set to 0 and number masking is enabled, it must be 0 (i.e. each numeric value is replaced with a single 0 because JSON does not support empty values).

      Default value: -1 (length obfuscation disabled).

      Returns:
      the builder instance
    • caseSensitiveTargetKeys

      public JsonMaskingConfig.Builder caseSensitiveTargetKeys()
      Configures whether the target keys are considered case-sensitive (e.g. cvv != CVV)

      Default value: false (target keys are considered case-insensitive)

      Returns:
      the builder instance
    • build

      public JsonMaskingConfig build()
      Creates a new JsonMaskingConfig instance.
      Returns:
      the new instance