Interface ParameterRedactor

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@ThreadSafe @FunctionalInterface public interface ParameterRedactor
Converts non-secure bound parameter values into safe display values for diagnostics.

This is display-only: it does not change what is bound to the database. Pyranid never invokes a ParameterRedactor for SecureParameter values; SecureParameter.getMask() always wins. For batch executions, Pyranid renders a bounded batch summary and does not invoke this redactor for individual batch values.

Redaction failures are fail-fast. If an implementation throws, Pyranid propagates the failure from the diagnostic rendering call site.

Since:
4.4.0
Author:
Mark Allen
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NonNull ParameterRedactor
    Acquires the default redactor, which renders non-secure values verbatim for non-batch executions.
    static @NonNull ParameterRedactor
    Acquires a redactor that masks every non-secure value as <redacted>.
    @Nullable Object
    redactParameter(@NonNull StatementContext<?> statementContext, int parameterIndex, @Nullable Object parameter)
    Redacts a single non-secure parameter for diagnostics.
  • Method Details

    • redactParameter

      @Nullable Object redactParameter(@NonNull StatementContext<?> statementContext, int parameterIndex, @Nullable Object parameter)
      Redacts a single non-secure parameter for diagnostics.
      Parameters:
      statementContext - current SQL context
      parameterIndex - zero-based index into StatementContext.getParameters() after IN-list expansion
      parameter - parameter value to render safely
      Returns:
      the safe display value
    • none

      static @NonNull ParameterRedactor none()
      Acquires the default redactor, which renders non-secure values verbatim for non-batch executions.
      Returns:
      the default redactor
    • redactAll

      static @NonNull ParameterRedactor redactAll()
      Acquires a redactor that masks every non-secure value as <redacted>.
      Returns:
      a redactor that masks every non-secure value