org.hibernate.validator.internal.constraintvalidators.hv.pl.NIPValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bean-validator Show documentation
Show all versions of bean-validator Show documentation
JSR 380's RI, Hibernate Validator version ${hibernate-validator.version} and its dependencies repackaged as OSGi bundle
/*
* Hibernate Validator, declare and validate application constraints
*
* License: Apache License, Version 2.0
* See the license.txt file in the root directory or .
*/
package org.hibernate.validator.internal.constraintvalidators.hv.pl;
import java.util.List;
import org.hibernate.validator.constraints.pl.NIP;
/**
* Validator for {@link NIP}.
*
* @author Marko Bekhta
*/
public class NIPValidator extends PolishNumberValidator {
private static final int[] WEIGHTS_NIP = { 6, 5, 7, 2, 3, 4, 5, 6, 7 };
@Override
public void initialize(NIP constraintAnnotation) {
super.initialize(
0,
Integer.MAX_VALUE,
-1,
true
);
}
@Override
protected int[] getWeights(List digits) {
return WEIGHTS_NIP;
}
}