Add ObjectAwareCleanser for cross-field @CustomSanitizer logic
The existing Cleanser<T> interface only sees a field's own value, so
@CustomSanitizer couldn't support rules that depend on sibling fields
(e.g. a postal code cleanser that behaves differently based on a
country field on the same object). Adds ObjectAwareCleanser<T>, whose
cleanse(Object owner, T value) also receives the owning object, and
wires CustomSanitation to dispatch to it when present, falling back to
the existing Cleanser path unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5cf73f0 commit 00cb703cd3f541abc073dae3de80274b4bb453d0
@aljunggren aljunggren authored on 21 Jun
Showing 3 changed files
View
src/main/java/io/ljunggren/sanitizer/cleanser/ObjectAwareCleanser.java 0 → 100644
View
src/main/java/io/ljunggren/sanitizer/sanitation/CustomSanitation.java
View
src/test/java/io/ljunggren/sanitizer/sanitation/CustomSanitationExtraTest.java