cn.ipokerface.common.validation.validator.ConstraintValidator Maven / Gradle / Ivy
Show all versions of common-beans Show documentation
package cn.ipokerface.common.validation.validator;
import java.lang.annotation.Annotation;
/**
* Created by PokerFace
* Create Date 2019-11-25.
* Email: [email protected]
* Version 1.0.0
*
* Description: Abstract constraint's validator of all kinds of validators.
* Defines the logic to validate a given constraint {@code A}
* for a given object type {@code T}.
*
* Implementations must comply to the following restriction:
*
* - {@code T} must resolve to a non parameterized type
* - or generic parameters of {@code T} must be unbounded
* wildcard types
*
*
* The annotation can be put on a
* {@code ConstraintValidator} implementation to mark it as supporting
* cross-parameter constraints. Check out
* and {@link cn.ipokerface.common.validation.validator.Constraint} for more information.
*
*/
public interface ConstraintValidator {
/**
* main method that invoke by {@link cn.ipokerface.common.validation.Validator}
* in {@link cn.ipokerface.common.validation.ValidatorContext} to validate parameter
* under the A
annotation.
*
* @param value parameter value
* @param constraintAnnotation parameter annotation
* @return if it is complete by this validator.
*/
public boolean validate(T value, A constraintAnnotation);
}