Class SanitizerRegistry
java.lang.Object
io.github.rabinarayanpatra.sanitizer.spring.registry.SanitizerRegistry
Spring-based registry for resolving
FieldSanitizer instances by class
type.
This component is autoconfigured by Spring and automatically populated with
all available FieldSanitizer beans, allowing reusable lookup and
injection in places like entity listeners or deserializers.
- Since:
- 1.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionSanitizerRegistry(List<io.github.rabinarayanpatra.sanitizer.core.FieldSanitizer<?>> sanitizers) Constructs the registry by collecting allFieldSanitizerbeans available in the Spring context. -
Method Summary
-
Constructor Details
-
SanitizerRegistry
@Autowired public SanitizerRegistry(List<io.github.rabinarayanpatra.sanitizer.core.FieldSanitizer<?>> sanitizers) Constructs the registry by collecting allFieldSanitizerbeans available in the Spring context.- Parameters:
sanitizers- the list of all discovered sanitizers
-
-
Method Details
-
get
public <T> io.github.rabinarayanpatra.sanitizer.core.FieldSanitizer<T> get(Class<? extends io.github.rabinarayanpatra.sanitizer.core.FieldSanitizer<T>> cls) Retrieves a registered sanitizer instance by its class.- Type Parameters:
T- the type the sanitizer handles- Parameters:
cls- the sanitizer implementation class- Returns:
- the matching sanitizer instance
- Throws:
IllegalArgumentException- if no matching sanitizer is found
-