Class SanitizerRegistry

java.lang.Object
io.github.rabinarayanpatra.sanitizer.spring.registry.SanitizerRegistry

public class SanitizerRegistry extends Object
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

    Constructors
    Constructor
    Description
    SanitizerRegistry(List<io.github.rabinarayanpatra.sanitizer.core.FieldSanitizer<?>> sanitizers)
    Constructs the registry by collecting all FieldSanitizer beans available in the Spring context.
  • Method Summary

    Modifier and Type
    Method
    Description
    <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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SanitizerRegistry

      @Autowired public SanitizerRegistry(List<io.github.rabinarayanpatra.sanitizer.core.FieldSanitizer<?>> sanitizers)
      Constructs the registry by collecting all FieldSanitizer beans 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