Package org.apache.juneau.commons.bean
Interface PropertyValidatorFactory
- All Known Implementing Classes:
JsonSchemaPropertyValidatorFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Builds
PropertyValidator instances from a JSON-Schema-shaped map of constraints.
The factory is resolved at runtime via ServiceLoader through
PropertyValidators.factory(). If no factory is on the classpath (i.e. juneau-bean-jsonschema is
not present), schema-validation mode silently becomes a no-op.
The marshalling side calls the factory once per bean property at BeanMeta construction time and installs
the resulting validator into the property's read/write transform slots.
Thread safety
Factory implementations must be safe to invoke from multiple threads concurrently.- Since:
- 10.0.0
- See Also:
-
Method Summary
-
Method Details
-
create
Builds a validator from a JSON-Schema-shaped map of constraints.- Parameters:
schemaMap- A map mirroring the JSON Schema constraint shape (the same shape produced bySchemaAnnotation.asMap()). May be empty, in which case implementations should returnnull .propertyType- The Java type of the property being validated. May be used by the factory to choose narrower numeric or collection validators. May benull .- Returns:
- A validator, or
null if the map carries no actionable constraints.
-