Annotation Interface Contract.Mask

Enclosing class:
Contract

@API(status=MAINTAINED) @Contract @Target({PARAMETER,METHOD,FIELD,ANNOTATION_TYPE}) @Retention(RUNTIME) @Documented public static @interface Contract.Mask
Marks a value as confidential for generated violation messages.

Mask is not a validity check. It changes only how generated violation messages render the annotated parameter or return value. The raw value must not appear in generated messages when this annotation applies.

This annotation can be used directly on supported program elements or as part of a custom composed contract annotation. If the value is null, masking still affects only message rendering and never makes null a contract violation.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? extends MaskRenderer>
    Renderer used to produce the message-safe representation.
  • Element Details

    • renderer

      Class<? extends MaskRenderer> renderer
      Renderer used to produce the message-safe representation.

      The default renderer returns a fixed conservative value and reveals no original content, length, or other value details.

      Returns:
      the renderer type used for generated violation messages
      Default:
      media.barney.contract.DefaultMaskRenderer.class