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 ElementsModifier and TypeRequired ElementDescriptionClass<? extends FieldSanitizer<?>>[]The ordered list of FieldSanitizer implementations to apply. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionOptional comma-separatedkey=valueconfiguration parameters passed toConfigurableFieldSanitizerimplementations.
-
Element Details
-
using
Class<? extends FieldSanitizer<?>>[] usingThe ordered list of FieldSanitizer implementations to apply.- Returns:
- the sanitizer classes
-
params
String paramsOptional comma-separatedkey=valueconfiguration parameters passed toConfigurableFieldSanitizerimplementations. Ignored for non-configurable sanitizers.Example:
params = "maxLength=100,suffix=..."orparams = "reveal=4"- Returns:
- the parameter string, empty by default
- Since:
- 1.1.0
- Default:
""
-