Interface AttributeValidatorRegistry


public interface AttributeValidatorRegistry
Manages registered attribute validators.

This code is experimental. While this interface is functional and tested, it may change or be removed in a future version of the library.

  • Method Details

    • registerValidators

      void registerValidators(String attributeName, Set<? extends AttributeValidator> validators)
      Registers the given AttributeValidator(s) to the given attribute name.

      This method doesn't care whether an attribute with the given name actually exists; it is only responsible for managing the validators associated with a given attribute name.

      Note that the AttributeValidator implementations registered should implement Object.hashCode() and Object.equals(Object) so that duplicate validators aren't registered for an attribute.

      Parameters:
      attributeName - the name of the attribute that the given validators will validate
      validators - the AttributeValidators to apply to the attribute
      Throws:
      IllegalArgumentException - if attributeName is null, or if no AttributeValidators were passed
    • deregisterValidators

      void deregisterValidators(String attributeName)
      Deregisters all AttributeValidators associated with the given attribute name.

      Does nothing if there are no validators registered to the given attribute name.

      Parameters:
      attributeName - the name of the attribute whose validators will be deregistered, cannot be null
      Throws:
      IllegalArgumentException - if attributeName is null
    • getValidators

      Set<AttributeValidator> getValidators(String attributeName)
      Gets all the AttributeValidators associated with the given attribute name.
      Parameters:
      attributeName - the name of the attribute, cannot be null
      Returns:
      the set of AttributeValidators registered to the attribute, or an empty set if no attribute by that name exists.
      Throws:
      IllegalArgumentException - if attributeName is null