Package ddf.catalog.validation
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 Summary
Modifier and TypeMethodDescriptionvoidderegisterValidators(String attributeName) Deregisters allAttributeValidators associated with the given attribute name.getValidators(String attributeName) Gets all theAttributeValidators associated with the given attribute name.voidregisterValidators(String attributeName, Set<? extends AttributeValidator> validators) Registers the givenAttributeValidator(s) to the given attribute name.
-
Method Details
-
registerValidators
Registers the givenAttributeValidator(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
AttributeValidatorimplementations registered should implementObject.hashCode()andObject.equals(Object)so that duplicate validators aren't registered for an attribute.- Parameters:
attributeName- the name of the attribute that the given validators will validatevalidators- theAttributeValidators to apply to the attribute- Throws:
IllegalArgumentException- ifattributeNameis null, or if noAttributeValidators were passed
-
deregisterValidators
Deregisters allAttributeValidators 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- ifattributeNameis null
-
getValidators
Gets all theAttributeValidators 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- ifattributeNameis null
-