Package io.envoyproxy.pgv
Class ExplicitValidatorIndex
java.lang.Object
io.envoyproxy.pgv.ExplicitValidatorIndex
- All Implemented Interfaces:
ValidatorIndex
public final class ExplicitValidatorIndex extends Object implements ValidatorIndex
ExplicitValidatorIndex is an explicit registry of Validator instances. If no validator is registered
for type, a fallback validator will be used (default ALWAYS_VALID).-
Field Summary
-
Constructor Summary
Constructors Constructor Description ExplicitValidatorIndex()ExplicitValidatorIndex(ValidatorIndex fallbackIndex) -
Method Summary
Modifier and Type Method Description <T> ExplicitValidatorIndexadd(Class<T> forType, ValidatorImpl<T> validator)Adds aValidatorto the set of known validators.<T> Validator<T>validatorFor(Class clazz)Retuns the validator forclazz, orALWAYS_VALIDif not found.
-
Constructor Details
-
ExplicitValidatorIndex
public ExplicitValidatorIndex() -
ExplicitValidatorIndex
-
-
Method Details
-
add
Adds aValidatorto the set of known validators.- Parameters:
forType- the type to validatevalidator- the validator to apply- Returns:
- this
-
validatorFor
Description copied from interface:ValidatorIndexRetuns the validator forclazz, orALWAYS_VALIDif not found.- Specified by:
validatorForin interfaceValidatorIndex
-