Interface PropertyValidator
- All Known Implementing Classes:
JsonSchemaValidator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Implementations of this interface are built by a PropertyValidatorFactory and installed on the marshalling
side (via readTransform / writeTransform)
once per bean property at BeanMeta construction time. The instance is then invoked from
BeanPropertyMeta.get(org.apache.juneau.commons.bean.BeanMap<?>, java.lang.String) / BeanPropertyMeta.set(org.apache.juneau.commons.bean.BeanMap<?>, java.lang.String, java.lang.Object) at runtime when schema validation is enabled.
The commons-side SPI does not depend on any marshalling-side or juneau-bean-jsonschema types. The concrete
implementation that ships with Juneau is backed by the typed JsonSchema bean and lives in
juneau-bean-jsonschema; it is discovered at runtime via ServiceLoader.
Thread safety
Implementations must be safe to invoke from multiple threads concurrently, since a single validator is shared by all marshalling sessions for a givenBeanMeta.- Since:
- 10.0.0
- See Also:
-
Method Summary
-
Method Details
-
validate
Validates the given value against the schema this validator was built from.- Parameters:
value- The value to validate. May benull .- Throws:
SchemaValidationException- If the value violates the schema.
-