Annotation Interface Sanitize


Apply one or more FieldSanitizer implementations to this field, in the order listed. Sanitizers are applied in array order, so @Sanitize(using = {TrimSanitizer.class, LowerCaseSanitizer.class}) guarantees trim-then-lowercase.

This annotation is Repeatable, so multiple @Sanitize annotations can be stacked on the same field. Sanitizers are applied in declaration order.

Example:

 {
        @code
        public class Person {
                @Sanitize(using = TrimSanitizer.class)
                @Sanitize(using = CollapseWhitespaceSanitizer.class)
                @Sanitize(using = LowerCaseSanitizer.class)
                private String fullName;
        }
 }
 
Since:
1.0.0
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Class<? extends FieldSanitizer<?>>[]
    The ordered list of FieldSanitizer implementations to apply.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional comma-separated key=value configuration parameters passed to ConfigurableFieldSanitizer implementations.
  • Element Details

    • using

      Class<? extends FieldSanitizer<?>>[] using
      The ordered list of FieldSanitizer implementations to apply.
      Returns:
      the sanitizer classes
    • params

      String params
      Optional comma-separated key=value configuration parameters passed to ConfigurableFieldSanitizer implementations. Ignored for non-configurable sanitizers.

      Example: params = "maxLength=100,suffix=..." or params = "reveal=4"

      Returns:
      the parameter string, empty by default
      Since:
      1.1.0
      Default:
      ""