com.github.ldeitos.validation.Validator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of extendedValidation-core Show documentation
Show all versions of extendedValidation-core Show documentation
Extension for BeanValidation API Core. Content interfaces, qualifiers and constraints definitions.
This version is Java 17 and JakartaEE 10 compatible.
The newest version!
package com.github.ldeitos.validation;
import java.util.Set;
import jakarta.validation.groups.Default;
import com.github.ldeitos.exception.ViolationException;
/**
* Interface to ExtendedValidator implementation.
*
* @author Leandro Deitos
*
*/
public interface Validator extends jakarta.validation.Validator {
/**
* @param object
* Object to validate
* @param groups
* The group or list of groups targeted for validation (defaults
* to {@link Default})
* @return Violations messages or empty if none.
*/
public Set validateBean(T object, Class>... groups);
/**
* @param object
* Object to validate
* @param propertyName
* Property to validate (i.e. field and getter constraints)
* @param groups
* The group or list of groups targeted for validation (defaults
* to {@link Default})
* @return Violations messages or empty if none.
*/
public Set validatePropertyBean(T object, String propertyName, Class>... groups);
/**
* @param beanType
* The bean type
* @param propertyName
* Property to validate
* @param value
* Property value to validate
* @param groups
* The group or list of groups targeted for validation (defaults
* to {@link Default}).
* @return Violations messages or empty if none.
*/
public Set validateValueBean(Class beanType, String propertyName, Object value,
Class>... groups);
/**
* @param object
* Object to validate
* @param groups
* The group or list of groups targeted for validation (defaults
* to {@link Default})
* @throws ViolationException
* Occurs when object under validation has violations.
* @since 0.9.2
*/
public void validateAndThrow(T object, Class>... groups) throws ViolationException;
}