Interface Validator
- All Known Implementing Classes:
DefaultValidator
public interface Validator
Validates objects based on their annotations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Validatorcreate()Creates a default validator.@NotNull ValidationResultValidates an object and returns all errors.@NotNull ValidationResultvalidate(@NotNull Object object, @NotNull PropertyPath basePath) Validates an object at a specific path context.voidvalidateOrThrow(@NotNull Object object) Validates and throws if invalid (for fail-fast mode).
-
Method Details
-
validate
Validates an object and returns all errors.- Parameters:
object- the object to validate- Returns:
- the validation result
-
validate
@NotNull @NotNull ValidationResult validate(@NotNull @NotNull Object object, @NotNull @NotNull PropertyPath basePath) Validates an object at a specific path context.- Parameters:
object- the object to validatebasePath- the base path for error reporting- Returns:
- the validation result
-
validateOrThrow
Validates and throws if invalid (for fail-fast mode).- Parameters:
object- the object to validate- Throws:
ValidationException- if validation fails
-
create
Creates a default validator.- Returns:
- a new validator
-